Skip to content

Commit 0a3e618

Browse files
authored
Merge pull request #13 from davidszotten/pytest37-compat
add compat for pytest 3.7
2 parents a23ed60 + 14d8092 commit 0a3e618

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

pytest_stepwise/compat.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
except ImportError:
66
from pytest_cache import Cache
77

8+
try:
9+
# pytest 3.7+
10+
Cache = Cache.for_config
11+
except AttributeError:
12+
pass
13+
814

915
if hasattr(pytest, 'hookimpl'):
1016
tryfirst = pytest.hookimpl(tryfirst=True)

tests/test_pytest_stepwise.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,7 @@ def test_stop_on_collection_errors(broken_testdir):
132132
result = broken_testdir.runpytest('-v', '--strict', '--stepwise', 'working_testfile.py', 'broken_testfile.py')
133133

134134
stdout = result.stdout.str()
135-
assert 'Error when collecting test' in stdout
135+
if pytest.__version__ < '3.0.0':
136+
assert 'Error when collecting test' in stdout
137+
else:
138+
assert 'errors during collection' in stdout

tox.ini

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[tox]
2+
envlist = py27-{pytest23,pytest27}, {py27,py36}-{pytest28,pytest29,pytest30,pytest37}
3+
4+
[testenv]
5+
deps =
6+
pytest23: pytest==2.3
7+
pytest23: pytest-cache
8+
pytest27: pytest==2.7
9+
pytest27: pytest-cache
10+
pytest28: pytest==2.8
11+
pytest29: pytest==2.9
12+
pytest30: pytest==3.0
13+
pytest37: pytest==3.7
14+
commands =
15+
py.test tests {posargs}

0 commit comments

Comments
 (0)