Last active
March 2, 2018 13:40
-
-
Save apahim/7d9aa165e54b6ed43f36542580df46c7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from avocado import Test | |
from avocado import skipIf | |
_SKIP_CONTROL = '/tmp/skip.control' | |
def _should_i_skip(): | |
try: | |
with open(_SKIP_CONTROL, 'r') as file_obj: | |
res = file_obj.read() | |
if res and int(res): | |
return True | |
except: | |
return False | |
return False | |
def _skip_next(skip=True): | |
with open(_SKIP_CONTROL, 'w') as file_obj: | |
if skip: | |
file_obj.write('1') | |
else: | |
file_obj.write('0') | |
class MyTest(Test): | |
def test_01(self): | |
_skip_next() | |
@skipIf(_should_i_skip(), 'Test skipped') | |
def test_02(self): | |
pass | |
def test_03(self): | |
_skip_next(False) | |
@skipIf(_should_i_skip(), 'Test skipped') | |
def test_04(self): | |
pass | |
def test_05(self): | |
_skip_next() | |
@skipIf(_should_i_skip(), 'Test skipped') | |
def test_06(self): | |
pass |
Author
apahim
commented
Mar 2, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment