1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2024-11-22 03:46:29 +00:00

TESTS: add pytest incremental marker to mark tests as expected to fail if previous test failed

see http://stackoverflow.com/a/12579625/107049
This commit is contained in:
Thomas LEVEIL 2017-02-21 01:04:50 +01:00
parent a3fbaa5990
commit e25c78b00a

View File

@ -445,6 +445,18 @@ def pytest_runtest_logreport(report):
report.longrepr.addsection('nginx-proxy conf', get_nginx_conf_from_container(container))
# Py.test `incremental` marker, see http://stackoverflow.com/a/12579625/107049
def pytest_runtest_makereport(item, call):
if "incremental" in item.keywords:
if call.excinfo is not None:
parent = item.parent
parent._previousfailed = item
def pytest_runtest_setup(item):
previousfailed = getattr(item.parent, "_previousfailed", None)
if previousfailed is not None:
pytest.xfail("previous test failed (%s)" % previousfailed.name)
###############################################################################
#