Skip to content

Commit

Permalink
add compat for pytest 3.7 and tox config for (some of) the versions i…
Browse files Browse the repository at this point in the history
… could still get working
  • Loading branch information
davidszotten committed Aug 1, 2018
1 parent a23ed60 commit 14d8092
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pytest_stepwise/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion tests/test_pytest_stepwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 14d8092

Please sign in to comment.