import pytest

class MenderTesting(object):
    slow = pytest.mark.skipif(not pytest.config.getoption("--runslow"), reason="need --runslow option to run")
    fast = pytest.mark.skipif(not pytest.config.getoption("--runfast"), reason="need --runfast option to run")
    nightly = pytest.mark.skipif(not pytest.config.getoption("--runnightly"), reason="need --runnightly option to run")

import pytest

class MenderTesting(object):
    slow_cond = False
    fast_cond = False
    nightly_cond = False

    slow = None
    fast = None
    nightly = None

if pytest.config.getoption("--runslow"):
    MenderTesting.slow_cond = True
else:
    MenderTesting.slow_cond = False

if pytest.config.getoption("--runfast"):
    MenderTesting.fast_cond = True
else:
    MenderTesting.fast_cond = False

if pytest.config.getoption("--runnightly"):
    MenderTesting.nightly_cond = True
else:
    MenderTesting.nightly_cond = False

if not MenderTesting.slow_cond and not MenderTesting.fast_cond and not MenderTesting.nightly_cond:
    # Default to running everything but nightly.
    MenderTesting.slow_cond = True
    MenderTesting.fast_cond = True

MenderTesting.slow = pytest.mark.skipif(not MenderTesting.slow_cond, reason="need --runslow option to run")
MenderTesting.fast = pytest.mark.skipif(not MenderTesting.fast_cond, reason="need --runfast option to run")
MenderTesting.nightly = pytest.mark.skipif(not MenderTesting.nightly_cond, reason="need --runnightly option to run")

Fix no tests running when not passing any options.
Fix no tests running when not passing any options.

Signed-off-by: Kristian Amlie <505e66ae45028a0596c853559221f0b72c1cee21@mender.io>

  import pytest
  
  class MenderTesting(object):
-     slow = pytest.mark.skipif(not pytest.config.getoption("--runslow"), reason="need --runslow option to run")
-     fast = pytest.mark.skipif(not pytest.config.getoption("--runfast"), reason="need --runfast option to run")
-     nightly = pytest.mark.skipif(not pytest.config.getoption("--runnightly"), reason="need --runnightly option to run")
+     slow_cond = False
+     fast_cond = False
+     nightly_cond = False
  
+     slow = None
+     fast = None
+     nightly = None
+ 
+ if pytest.config.getoption("--runslow"):
+     MenderTesting.slow_cond = True
+ else:
+     MenderTesting.slow_cond = False
+ 
+ if pytest.config.getoption("--runfast"):
+     MenderTesting.fast_cond = True
+ else:
+     MenderTesting.fast_cond = False
+ 
+ if pytest.config.getoption("--runnightly"):
+     MenderTesting.nightly_cond = True
+ else:
+     MenderTesting.nightly_cond = False
+ 
+ if not MenderTesting.slow_cond and not MenderTesting.fast_cond and not MenderTesting.nightly_cond:
+     # Default to running everything but nightly.
+     MenderTesting.slow_cond = True
+     MenderTesting.fast_cond = True
+ 
+ MenderTesting.slow = pytest.mark.skipif(not MenderTesting.slow_cond, reason="need --runslow option to run")
+ MenderTesting.fast = pytest.mark.skipif(not MenderTesting.fast_cond, reason="need --runfast option to run")
+ MenderTesting.nightly = pytest.mark.skipif(not MenderTesting.nightly_cond, reason="need --runnightly option to run")
+ 
Fix no tests running when not passing any options.
## Code Before:
import pytest

class MenderTesting(object):
    slow = pytest.mark.skipif(not pytest.config.getoption("--runslow"), reason="need --runslow option to run")
    fast = pytest.mark.skipif(not pytest.config.getoption("--runfast"), reason="need --runfast option to run")
    nightly = pytest.mark.skipif(not pytest.config.getoption("--runnightly"), reason="need --runnightly option to run")

## Instruction:
Fix no tests running when not passing any options.
## Code After:
import pytest

class MenderTesting(object):
    slow_cond = False
    fast_cond = False
    nightly_cond = False

    slow = None
    fast = None
    nightly = None

if pytest.config.getoption("--runslow"):
    MenderTesting.slow_cond = True
else:
    MenderTesting.slow_cond = False

if pytest.config.getoption("--runfast"):
    MenderTesting.fast_cond = True
else:
    MenderTesting.fast_cond = False

if pytest.config.getoption("--runnightly"):
    MenderTesting.nightly_cond = True
else:
    MenderTesting.nightly_cond = False

if not MenderTesting.slow_cond and not MenderTesting.fast_cond and not MenderTesting.nightly_cond:
    # Default to running everything but nightly.
    MenderTesting.slow_cond = True
    MenderTesting.fast_cond = True

MenderTesting.slow = pytest.mark.skipif(not MenderTesting.slow_cond, reason="need --runslow option to run")
MenderTesting.fast = pytest.mark.skipif(not MenderTesting.fast_cond, reason="need --runfast option to run")
MenderTesting.nightly = pytest.mark.skipif(not MenderTesting.nightly_cond, reason="need --runnightly option to run")
