From d9c428c1ded12bae5ac98c6780e20bb0d211c90a Mon Sep 17 00:00:00 2001 From: David Szotten Date: Wed, 1 Aug 2018 11:48:15 +0100 Subject: [PATCH] add compat for pytest 3.7 and tox config for (some of) the versions i could still get working --- pytest_stepwise/compat.py | 6 ++++++ tests/test_pytest_stepwise.py | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pytest_stepwise/compat.py b/pytest_stepwise/compat.py index ce28f7474..a1cc1e986 100644 --- a/pytest_stepwise/compat.py +++ b/pytest_stepwise/compat.py @@ -5,6 +5,12 @@ try: except ImportError: from pytest_cache import Cache +try: + # pytest 3.7+ + Cache = Cache.for_config +except AttributeError: + pass + if hasattr(pytest, 'hookimpl'): tryfirst = pytest.hookimpl(tryfirst=True) diff --git a/tests/test_pytest_stepwise.py b/tests/test_pytest_stepwise.py index 1d0c4e8a8..cb52e9ead 100644 --- a/tests/test_pytest_stepwise.py +++ b/tests/test_pytest_stepwise.py @@ -132,4 +132,7 @@ def test_stop_on_collection_errors(broken_testdir): result = broken_testdir.runpytest('-v', '--strict', '--stepwise', 'working_testfile.py', 'broken_testfile.py') stdout = result.stdout.str() - assert 'Error when collecting test' in stdout + if pytest.__version__ < '3.0.0': + assert 'Error when collecting test' in stdout + else: + assert 'errors during collection' in stdout