-
Notifications
You must be signed in to change notification settings - Fork 101
/
tox.ini
64 lines (59 loc) · 1.73 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
63
64
[tox]
requires =
tox>=4
envlist =
lint
py{38,39,310,311}
pydantic1
[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 --all-extras
poetry run pytest {posargs}
[testenv:pydantic1]
allowlist_externals = poetry
commands_pre =
poetry install --no-root --sync --all-extras
# 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>=1,<2'
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
# Ensure this version stays in sync with .pre-commit-config.yaml
ruff==0.4.8
commands =
black {posargs:.}
ruff --fix {posargs:.}
[testenv:lint]
description = Run code linters.
skip_install = true
deps =
black
# Ensure this version stays in sync with .pre-commit-config.yaml
ruff==0.4.8
commands =
ruff check {posargs:.}
black --check --diff {posargs:.}