Last active
August 11, 2016 14:44
-
-
Save hackebrot/491452892292646cb6d83a5c2f653739 to your computer and use it in GitHub Desktop.
Skipped test should be an error
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
@pytest.hookimpl(hookwrapper=True) | |
def pytest_runtest_makereport(item, call): | |
outcome = yield | |
rep = outcome.get_result() | |
if pytest.config.getoption('--error-for-skips'): | |
if rep.skipped and call.excinfo.errisinstance(pytest.skip.Exception): | |
rep.outcome = 'failed' | |
r = call.excinfo._getreprcrash() | |
rep.longrepr = 'Skipped test - {message}'.format(message=r.message) | |
def pytest_addoption(parser): | |
parser.addoption( | |
'--error-for-skips', | |
action='store_true', | |
default=False, | |
help='Treat skipped tests as errors' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment