Skip to content

Commit 57f0d54

Browse files
authored
tests: use --import-mode=importlib (#1467)
Turns out, it's the only mode where `import src` doesn't fail.
1 parent 666edb6 commit 57f0d54

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pyproject.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Tidelift = "https://tidelift.com/subscription/pkg/pypi-attrs?utm_source=pypi-att
3939
[dependency-groups]
4040
mypy = [
4141
{ include-group = "tests" },
42-
'pytest-mypy-plugins; platform_python_implementation == "CPython" and python_version >= "3.10"'
42+
'pytest-mypy-plugins; platform_python_implementation == "CPython" and python_version >= "3.10"',
4343
]
4444
tests = [
4545
# For regression test to ensure cloudpickle compat doesn't break.
@@ -49,10 +49,7 @@ tests = [
4949
"pytest",
5050
"pytest-xdist[psutil]",
5151
]
52-
cov = [
53-
{ include-group = "tests" },
54-
"coverage[toml]",
55-
]
52+
cov = [{ include-group = "tests" }, "coverage[toml]"]
5653
pyright = ["pyright", { include-group = "tests" }]
5754
benchmark = [
5855
{ include-group = "tests" },
@@ -151,7 +148,12 @@ img = "Polar.svg"
151148

152149

153150
[tool.pytest.ini_options]
154-
addopts = ["-ra", "--strict-markers", "--strict-config"]
151+
addopts = [
152+
"-ra",
153+
"--strict-markers",
154+
"--strict-config",
155+
"--import-mode=importlib", # make src truly unimportable
156+
]
155157
xfail_strict = true
156158
testpaths = "tests"
157159
filterwarnings = ["once::Warning", "ignore:::pympler[.*]"]

0 commit comments

Comments
 (0)