Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

Commit f30c4ab

Browse files
committed
Refactor tox.ini environments to remove Cartesian product
It's tedious to maintain the Cartesian product of Python versions and pytest versions in tox.ini. Instead of having tox derive the Python version from the environment name, we can just pass it in as an override.
1 parent ac1f21c commit f30c4ab

File tree

2 files changed

+19
-116
lines changed

2 files changed

+19
-116
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
python -m build
5858
5959
pytest_integration_tests:
60-
name: "PyTest Integration Tests: ${{ matrix.tox_env }}-${{ matrix.os }}"
60+
name: "PyTest Integration Tests: py${{ matrix.python }}-${{ matrix.tox_env }}-${{ matrix.os }}"
6161
runs-on: ${{ matrix.os }}
6262
needs:
6363
# Don't incur the cost of the test matrix if the basic build fails.
@@ -66,56 +66,16 @@ jobs:
6666
fail-fast: false
6767
matrix:
6868
os: [ubuntu-latest, windows-latest]
69+
python:
70+
- "3.7"
71+
- "3.8"
72+
- "3.9"
73+
- "3.10"
6974
tox_env:
70-
- py37-pytest62
71-
- py37-pytest70
72-
- py37-pytest71
73-
- py37-pytest72
74-
- py38-pytest62
75-
- py38-pytest70
76-
- py38-pytest71
77-
- py38-pytest72
78-
- py39-pytest62
79-
- py39-pytest70
80-
- py39-pytest71
81-
- py39-pytest72
82-
- py310-pytest62
83-
- py310-pytest70
84-
- py310-pytest71
85-
- py310-pytest72
86-
include:
87-
- tox_env: "py37-pytest62"
88-
python: "3.7"
89-
- tox_env: "py37-pytest70"
90-
python: "3.7"
91-
- tox_env: "py37-pytest71"
92-
python: "3.7"
93-
- tox_env: "py37-pytest72"
94-
python: "3.7"
95-
- tox_env: "py38-pytest62"
96-
python: "3.8"
97-
- tox_env: "py38-pytest70"
98-
python: "3.8"
99-
- tox_env: "py38-pytest71"
100-
python: "3.8"
101-
- tox_env: "py38-pytest72"
102-
python: "3.8"
103-
- tox_env: "py39-pytest62"
104-
python: "3.9"
105-
- tox_env: "py39-pytest70"
106-
python: "3.9"
107-
- tox_env: "py39-pytest71"
108-
python: "3.9"
109-
- tox_env: "py39-pytest72"
110-
python: "3.9"
111-
- tox_env: "py310-pytest62"
112-
python: "3.10"
113-
- tox_env: "py310-pytest70"
114-
python: "3.10"
115-
- tox_env: "py310-pytest71"
116-
python: "3.10"
117-
- tox_env: "py310-pytest72"
118-
python: "3.10"
75+
- pytest62
76+
- pytest70
77+
- pytest71
78+
- pytest72
11979

12080
steps:
12181
- uses: actions/checkout@v3
@@ -133,7 +93,10 @@ jobs:
13393
- name: Test
13494
run: |
13595
UNFLAKABLE_API_KEY=${{ secrets.UNFLAKABLE_API_KEY }} \
136-
tox -e ${{ matrix.tox_env }} --override testenv.pass_env=UNFLAKABLE_API_KEY -- \
96+
tox -e ${{ matrix.tox_env }} \
97+
--override testenv.pass_env=UNFLAKABLE_API_KEY \
98+
--override testenv.basepython=python${{ matrix.python }} \
99+
-- \
137100
--enable-unflakable \
138101
--test-suite-id 2AT4xgduQdwkVKSaO0qJ2Dqm2JY \
139102
-s \

tox.ini

Lines changed: 5 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,27 @@
11
# For more information about tox, see https://tox.readthedocs.io/en/latest/
22
[tox]
3-
envlist = py37-pytest{62,70,71,72},py38-pytest{62,70,71,72},py39-pytest{62,70,71,72},py310-pytest{62,70,71,72},flake8,mypy,pycodestyle
3+
envlist = pytest{62,70,71,72},flake8,mypy,pycodestyle
44

55
[testenv]
66
extras = dev
77
commands = pytest {posargs:tests}
88

9-
[testenv:py37-pytest62]
9+
[testenv:pytest62]
1010
deps =
1111
pytest>=6.2.0,<6.3.0
1212
pytest-xdist==2.3.0
1313

14-
[testenv:py37-pytest70]
14+
[testenv:pytest70]
1515
deps =
1616
pytest>=7.0.0,<7.1.0
1717
pytest-xdist==2.4.0
1818

19-
[testenv:py37-pytest71]
19+
[testenv:pytest71]
2020
deps =
2121
pytest>=7.1.0,<7.2.0
2222
pytest-xdist==2.5.0
2323

24-
[testenv:py37-pytest72]
25-
deps =
26-
pytest>=7.2.0,<7.3.0
27-
pytest-xdist==2.5.0
28-
29-
[testenv:py38-pytest62]
30-
deps =
31-
pytest>=6.2.0,<6.3.0
32-
pytest-xdist==2.3.0
33-
34-
[testenv:py38-pytest70]
35-
deps =
36-
pytest>=7.0.0,<7.1.0
37-
pytest-xdist==2.4.0
38-
39-
[testenv:py38-pytest71]
40-
deps =
41-
pytest>=7.1.0,<7.2.0
42-
pytest-xdist==2.5.0
43-
44-
[testenv:py38-pytest72]
45-
deps =
46-
pytest>=7.2.0,<7.3.0
47-
pytest-xdist==2.5.0
48-
49-
[testenv:py39-pytest62]
50-
deps =
51-
pytest>=6.2.0,<6.3.0
52-
pytest-xdist==2.3.0
53-
54-
[testenv:py39-pytest70]
55-
deps =
56-
pytest>=7.0.0,<7.1.0
57-
pytest-xdist==2.4.0
58-
59-
[testenv:py39-pytest71]
60-
deps =
61-
pytest>=7.1.0,<7.2.0
62-
pytest-xdist==2.5.0
63-
64-
[testenv:py39-pytest72]
65-
deps =
66-
pytest>=7.2.0,<7.3.0
67-
pytest-xdist==2.5.0
68-
69-
[testenv:py310-pytest62]
70-
deps =
71-
pytest>=6.2.0,<6.3.0
72-
pytest-xdist==2.3.0
73-
74-
[testenv:py310-pytest70]
75-
deps =
76-
pytest>=7.0.0,<7.1.0
77-
pytest-xdist==2.4.0
78-
79-
[testenv:py310-pytest71]
80-
deps =
81-
pytest>=7.1.0,<7.2.0
82-
pytest-xdist==2.5.0
83-
84-
[testenv:py310-pytest72]
24+
[testenv:pytest72]
8525
deps =
8626
pytest>=7.2.0,<7.3.0
8727
pytest-xdist==2.5.0

0 commit comments

Comments
 (0)