Skip to content

Commit bf8757a

Browse files
authored
Merge pull request #388 from tomschr/feature/testpaths
tox/pytest: Add testpaths and use importlib
2 parents ff34cce + f24a1da commit bf8757a

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

changelog.d/388.trivial.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
For pytest, switch to the more modern :mod:`importlib` approach
2+
as it doesn't require to modify :data:`sys.path`:
3+
https://docs.pytest.org/en/7.2.x/explanation/pythonpath.html

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)