Skip to content

Commit 78c167e

Browse files
committed
Call pytest using "python -m pytest"
Directly calling "pytest" sometimes breaks tests on "pypy", such as pypa#234, because the actual current code is untested. As explained from pypy website <https://docs.pytest.org/en/latest/usage.html>: > ["python -m pytest"] is almost equivalent to invoking the command line > script pytest [...] directly, except that calling via python will also > add the current directory to sys.path. Note that, unlike tests for pypy, the pytest script is not directly invoked in tests for other Python interpreters.
1 parent 54d57d7 commit 78c167e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

noxfile.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ def coverage(*args):
2121
coverage("report", "-m", "--fail-under", "100")
2222
else:
2323
# Don't do coverage tracking for PyPy, since it's SLOW.
24-
session.run("pytest", "--capture=no", "--strict", *session.posargs)
24+
session.run(
25+
"python", "-m", "pytest", "--capture=no", "--strict", *session.posargs
26+
)
2527

2628

2729
@nox.session(python="3.8")

0 commit comments

Comments
 (0)