Skip to content

Commit 2c52be1

Browse files
henryiiiutgwkk
andcommitted
tests: combine and filter pytest versions
Co-authored-by: utagawa kiki <[email protected]>
1 parent 154215a commit 2c52be1

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

.github/workflows/test.yml

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,10 @@ jobs:
1919
- '3.8'
2020
- '3.9'
2121
- '3.10'
22-
pytest-version:
23-
- 4
24-
- 5
25-
- 6
26-
exclude:
27-
# pytest >= 5.x.x doesn't support Python 2.7
28-
- os: ubuntu-latest
29-
python-version: 2.7
30-
pytest-version: 5
31-
- os: ubuntu-latest
32-
python-version: 2.7
33-
pytest-version: 6
34-
- os: windows-latest
35-
python-version: 2.7
36-
pytest-version: 5
37-
- os: windows-latest
38-
python-version: 2.7
39-
pytest-version: 6
4022

4123
runs-on: ${{ matrix.os }}
4224

43-
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}, pytest ${{ matrix.pytest-version }}
25+
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}
4426
steps:
4527
- uses: actions/checkout@v3
4628

@@ -54,11 +36,36 @@ jobs:
5436
python -m pip install --upgrade pip
5537
pip install tox tox-gh-actions
5638
57-
- name: Run test
39+
- name: Run tests with PyTest 4
5840
run: tox
41+
if: ${{ matrix.python-version != '3.10' }}
5942
env:
6043
PLATFORM: ${{ matrix.os }}
61-
PYTEST_MAJOR_VERSION: ${{ matrix.pytest-version }}
44+
PYTEST_MAJOR_VERSION: 4
45+
PYTEST_PLUGINS: pytest_github_actions_annotate_failures
46+
47+
- name: Run tests with PyTest 5
48+
run: tox
49+
if: ${{ matrix.python-version != '2.7' && matrix.python-version != '3.10' }}
50+
env:
51+
PLATFORM: ${{ matrix.os }}
52+
PYTEST_MAJOR_VERSION: 5
53+
PYTEST_PLUGINS: pytest_github_actions_annotate_failures
54+
55+
- name: Run tests with PyTest 6
56+
run: tox
57+
if: ${{ matrix.python-version != '2.7' }}
58+
env:
59+
PLATFORM: ${{ matrix.os }}
60+
PYTEST_MAJOR_VERSION: 6
61+
PYTEST_PLUGINS: pytest_github_actions_annotate_failures
62+
63+
- name: Run tests with PyTest 7
64+
run: tox
65+
if: ${{ matrix.python-version != '2.7' }}
66+
env:
67+
PLATFORM: ${{ matrix.os }}
68+
PYTEST_MAJOR_VERSION: 7
6269
PYTEST_PLUGINS: pytest_github_actions_annotate_failures
6370

6471
post-test:

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ PYTEST_MAJOR_VERSION =
1919
4: pytest4
2020
5: pytest5
2121
6: pytest6
22+
7: pytest6
2223

2324
[testenv]
2425
deps =
2526
-rrequirements.txt
2627
pytest4: pytest>=4.0.0,<5.0.0
2728
pytest5: pytest>=5.0.0,<6.0.0
2829
pytest6: pytest>=6.0.0,<7.0.0
30+
pytest7: pytest>=7.0.0,<8.0.0
2931

3032
commands = {envpython} -m pytest

0 commit comments

Comments
 (0)