mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-24 20:47:54 +00:00
Add tox configuration
Tox manages test environments for all supported Python versions, as well as linting and formatting tools. On GitHub, the test and lint steps are kept as close as possible to the Makefile equivalents.
This commit is contained in:
47
tox.ini
Normal file
47
tox.ini
Normal file
@@ -0,0 +1,47 @@
|
||||
[tox]
|
||||
env_list =
|
||||
py37,py38,py39,py310,py311
|
||||
minversion = 4.5.1
|
||||
|
||||
[gh-actions]
|
||||
# Map Github Actions Python version to environment factors
|
||||
# Requires tox-gh-actions 3.x is installed in the GitHub action
|
||||
python =
|
||||
3.7: py37
|
||||
3.8: py38
|
||||
3.9: py39
|
||||
3.10: py310
|
||||
3.11: py311
|
||||
|
||||
[testenv]
|
||||
description = Run the tests with pytest
|
||||
package = wheel
|
||||
extras = all
|
||||
set_env =
|
||||
# trick poetry into adopting the tox virtualenv
|
||||
POETRY_VIRTUALENVS_PATH = {[tox]work_dir}
|
||||
allowlist_externals = poetry
|
||||
commands_pre =
|
||||
poetry install --no-root --sync --all-extras
|
||||
commands =
|
||||
python -X dev -m pytest {tty:--color=yes} {posargs}
|
||||
|
||||
[testenv:lint]
|
||||
description = Run the linters
|
||||
skip_install = true
|
||||
commands_pre =
|
||||
poetry install --no-root --with=linting --sync --all-extras
|
||||
commands =
|
||||
black --check --diff .
|
||||
flake8
|
||||
mypy
|
||||
pyright
|
||||
|
||||
[testenv:format]
|
||||
description = Format the code
|
||||
skip_install = true
|
||||
commands_pre =
|
||||
poetry install --no-root --sync --with=linting
|
||||
commands =
|
||||
black .
|
||||
isort .
|
||||
Reference in New Issue
Block a user