Skip to content

Commit 8f07bab

Browse files
committed
Update tox.ini to run unit tests and mypy for each supported version of Python
1 parent e51462e commit 8f07bab

File tree

1 file changed

+12
-27
lines changed

1 file changed

+12
-27
lines changed

tox.ini

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,27 @@
11
[tox]
22
min_version = 4.0
3-
env_list = format, test_pydantic1, type_pydantic1, test_pydantic2, type_pydantic2, lint, py{3.9,3.10,3.11}
3+
env_list = format, lint, py{39,310,311}-pydantic{1,2}
44

55
[gh-actions]
66
python =
77
3.9: py39
88
3.10: py310
9-
3.11: py311, test_pydantic1, type_pydantic1, test_pydantic2, type_pydantic2, format, lint
9+
3.11: format, lint, py311
1010

11-
[testenv:test_pydantic1]
11+
[testenv]
1212
labels = core
1313
allowlist_externals = poetry
14+
# The "pydanticX:" prefixes are Tox factor-conditional settings.
15+
# https://tox.wiki/en/3.4.0/config.html?highlight=conditional#factors-and-factor-conditional-settings
16+
# Note that "poetry add" changes pyproject.toml, but at least we
17+
# change it back when the tests finish.
1418
commands_pre =
15-
poetry install --only main --only test --no-root --all-extras
16-
poetry add pydantic^1
17-
commands = poetry run pytest -vv tests
18-
19-
[testenv:type_pydantic1]
20-
allowlist_externals = poetry
21-
commands_pre =
22-
poetry install --no-root --all-extras
23-
poetry add pydantic^1
24-
commands = poetry run mypy openapi_pydantic tests
25-
26-
[testenv:test_pydantic2]
27-
labels = core
28-
allowlist_externals = poetry
29-
commands_pre =
30-
poetry install --only main --only test --no-root --all-extras
31-
poetry add 'pydantic>=1.8'
32-
commands = poetry run pytest -vv tests
33-
34-
[testenv:type_pydantic2]
35-
allowlist_externals = poetry
36-
commands_pre =
19+
pydantic1: poetry add pydantic<2
20+
pydantic2: poetry add pydantic>=1.8
3721
poetry install --no-root --all-extras
38-
poetry add 'pydantic>=1.8'
39-
commands = poetry run mypy openapi_pydantic tests
22+
commands =
23+
poetry run pytest -vv tests
24+
poetry run mypy openapi_pydantic tests
4025

4126
[testenv:format]
4227
allowlist_externals = poetry

0 commit comments

Comments
 (0)