diff --git a/pytest_stepwise/compat.py b/pytest_stepwise/compat.py index ce28f74..a1cc1e9 100644 --- a/pytest_stepwise/compat.py +++ b/pytest_stepwise/compat.py @@ -5,6 +5,12 @@ 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 1d0c4e8..cb52e9e 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 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..98a40cc --- /dev/null +++ b/tox.ini @@ -0,0 +1,15 @@ +[tox] +envlist = py27-{pytest23,pytest27}, {py27,py36}-{pytest28,pytest29,pytest30,pytest37} + +[testenv] +deps = + pytest23: pytest==2.3 + pytest23: pytest-cache + pytest27: pytest==2.7 + pytest27: pytest-cache + pytest28: pytest==2.8 + pytest29: pytest==2.9 + pytest30: pytest==3.0 + pytest37: pytest==3.7 +commands = + py.test tests {posargs}