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