Skip to content

Commit

Permalink
Refactor pytest and tox to use pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
VovaVili committed Nov 26, 2024
1 parent 7756d46 commit 5344bb0
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 66 deletions.
53 changes: 52 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dev = [
]
[tool.mypy]
plugins = ['pydantic.mypy']

[tool.ruff]
line-length = 100
[tool.ruff.lint.pycodestyle]
Expand All @@ -40,4 +41,54 @@ select = ["I", "D"]
# These rules conflict with some other rules
ignore = ["D203", "D213"]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["D104"]
"__init__.py" = ["D104"]

[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "module"

[tool.tox]
min_version = "4.23.2"
env_list = ["py312", "lint", "type", "fix"]
requires = ["tox-uv>=1.16.0"]
isolated_build = true

[tool.tox.env.default]
runner = "uv-venv-lock-runner"
description = "run unit tests"
deps = [
"pytest>=8.3.3",
"pytest-cov>=6.0.0",
]
allowlist_externals = ["pytest"]
commands = ["pytest {posargs:tests} --cov --cov-report=xml"]

[tool.tox.env.lint]
description = "run linters"
skip_install = true
deps = ["ruff>=0.7.4"]
allowlist_externals = ["ruff"]
commands = [
"ruff check {posargs:.}",
"ruff format --check {posargs:.}",
]

[tool.tox.env.type]
runner = "uv-venv-lock-runner"
description = "run type checks"
deps = ["mypy>=1.13.0"]
allowlist_externals = ["mypy"]
commands = ["mypy {posargs:src tests}"]

[tool.tox.env.fix]
description = "run code formatter and linter (auto-fix)"
skip_install = true
deps = ["pre-commit-uv>=4.1.1"]
allowlist_externals = ["pre-commit"]
commands = ["pre-commit run --all-files --show-diff-on-failure"]

[tool.tox.env.dev]
runner = "uv-venv-lock-runner"
description = "dev environment"
extras = ["dev", "test", "type"]
commands = ["uv pip tree"]
3 changes: 0 additions & 3 deletions pytest.ini

This file was deleted.

62 changes: 0 additions & 62 deletions tox.ini

This file was deleted.

0 comments on commit 5344bb0

Please sign in to comment.