Skip to content

Commit 7b4d5f6

Browse files
committed
tox/pytest: Add testpaths and use importlib
Switch to the more modern importlib approach as it doesn't require to modify sys.path: https://docs.pytest.org/en/7.2.x/explanation/pythonpath.html
1 parent ff34cce commit 7b4d5f6

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ semver = py.typed
5555
[tool:pytest]
5656
norecursedirs = .git build .env/ env/ .pyenv/ .tmp/ .eggs/ venv/
5757
testpaths = tests docs
58-
# pythonpath = src
58+
pythonpath = src tests
5959
filterwarnings =
6060
ignore:Function 'semver.*:DeprecationWarning
6161
# ' <- This apostroph is just to fix syntax highlighting
6262
addopts =
63-
# --import-mode=importlib
63+
--import-mode=importlib
6464
--no-cov-on-fail
6565
--cov=semver
6666
--cov-report=term-missing

tests/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import semver
66

7-
# sys.path.insert(0, "docs/usage")
8-
97
from coerce import coerce # noqa:E402
108
from semverwithvprefix import SemVerWithVPrefix # noqa:E402
119
import packaging.version

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ python =
1919
[testenv]
2020
description = Run test suite for {basepython}
2121
allowlist_externals = make
22+
skip_install = true
2223
commands = pytest {posargs:}
2324
deps =
2425
pytest

0 commit comments

Comments
 (0)