Skip to content

add compat for pytest 3.7 #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}