-
Notifications
You must be signed in to change notification settings - Fork 1
/
tox.ini
62 lines (57 loc) · 1.56 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[tox]
requires =
tox>=4
envlist =
lint
py{38,39,310,311}
pydantic2
[testenv]
# Running tests via poetry within the tox environment is not the ideal
# situation, but without it you don't get dev dependencies in the
# tox environment. There are other workaround, but most involve using
# extraneous dependency extras or maintaining a duplicate list of test
# dependencies. See:
# - https://github.com/python-poetry/poetry/issues/1941
# - https://python-poetry.org/docs/faq/#is-tox-supported
allowlist_externals = poetry
deps =
pytest
commands =
poetry install --no-root --sync
poetry run pytest {posargs}
[testenv:pydantic2]
allowlist_externals = poetry
commands_pre =
poetry install --no-root --sync
# This `pip` call looks weird but we want to avoid doing a `poetry add` or
# `poetry update` here because that will mess with the the pyproject.toml
# and poetry.lock. But we want this change to only to be ephemeral in the
# tox testenv.
poetry run pip install 'pydantic>=2,<3'
commands =
poetry run pytest {posargs}
[testenv:codespell]
description = Run spell checker.
skip_install = true
deps =
codespell
tomli # required for getting config from pyproject.toml
commands = codespell {posargs}
[testenv:format]
description = Run code formatters.
skip_install = true
deps =
black
ruff
commands =
black {posargs:.}
ruff --fix {posargs:.}
[testenv:lint]
description = Run code linters.
skip_install = true
deps =
black
ruff
commands =
ruff check {posargs:.}
black --check --diff {posargs:.}