Skip to content

Commit 59d4ae0

Browse files
committed
test with multiple major versions of pytest
1 parent a0ca6da commit 59d4ae0

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,24 @@ jobs:
1818
- '3.7'
1919
- '3.8'
2020
- '3.9'
21-
# TODO: test with specific major version of pytest
21+
pytest-version:
22+
- 4
23+
- 5
24+
- 6
25+
exclude:
26+
# pytest >= 5.x.x doesn't support Python 2.7
27+
- os: ubuntu-latest
28+
python-version: 2.7
29+
pytest-version: 5
30+
- os: ubuntu-latest
31+
python-version: 2.7
32+
pytest-version: 6
33+
- os: windows-latest
34+
python-version: 2.7
35+
pytest-version: 5
36+
- os: windows-latest
37+
python-version: 2.7
38+
pytest-version: 6
2239

2340
runs-on: ${{ matrix.os }}
2441

@@ -41,6 +58,7 @@ jobs:
4158
run: tox
4259
env:
4360
PLATFORM: ${{ matrix.os }}
61+
PYTEST_MAJOR_VERSION: ${{ matrix.pytest-version }}
4462
PYTEST_PLUGINS: pytest_github_actions_annotate_failures
4563

4664
post-test:

tox.ini

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{27,36,37,38,39}-{linux,windows}
2+
envlist = py{27}-pytest4-{linux,windows}, py{36,37,38,39}-pytest{4,5,6}-{linux,windows}
33

44
[gh-actions]
55
python =
@@ -14,10 +14,16 @@ PLATFORM =
1414
ubuntu-latest: linux
1515
windows-latest: windows
1616

17+
PYTEST_MAJOR_VERSION =
18+
4: pytest4
19+
5: pytest5
20+
6: pytest6
21+
1722
[testenv]
1823
deps =
19-
py27: pytest<5.0.0
20-
py{36,37,38,39}: pytest>=5.0.0
24+
pytest4: pytest>=4.0.0,<5.0.0
25+
pytest5: pytest>=5.0.0,<6.0.0
26+
pytest6: pytest>=6.0.0,<7.0.0
2127

2228
commands = {envpython} -m pytest
2329
passenv = GITHUB_ACTIONS

0 commit comments

Comments
 (0)