Skip to content

Commit

Permalink
move pytest options from pytest config to tox (#156)
Browse files Browse the repository at this point in the history
The --cov option was useless, since tox already uses `coverage run`
instead. While we are at it, we can also drop pytest-cov from the test
dependencies. One less wheel for tox to download and install.

The timeout option is moved to tox.

Both of these options add additional dependencies for running `pytest`
outside of tox, which may sometimes be desired if you really know what
you are doing. There is no way to disable them other than by patching
out the addopts configuration. Best to specify this only in tox, which
is designed to set up the appropriate environments already.

Bug: https://bugs.gentoo.org/922192
  • Loading branch information
eli-schwartz authored Jan 28, 2024
1 parent 5271061 commit ce2e6a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ dependencies = [
cli = ["click"]
tests = [
"pytest",
"pytest-cov",
"pytest-timeout",
"coverage[toml]",
]
Expand Down Expand Up @@ -80,7 +79,7 @@ exclude = [
namespaces = false

[tool.pytest.ini_options]
addopts = "-ra --timeout 300 --cov"
addopts = "-ra"
testpaths = ["tests/"]
norecursedirs = [".*", "build", "dist", "news", "tasks", "docs"]
markers = [
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ setenv =
LC_ALL = en_US.UTF-8
deps =
-e .[tests,cli]
commands = coverage run -m pytest
commands = coverage run -m pytest --timeout 300
install_command = python -m pip install {opts} {packages} --upgrade-strategy=eager
usedevelop = True

Expand Down

0 comments on commit ce2e6a4

Please sign in to comment.