From 78c167e873d6a6f015d8ea97871031741b894756 Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Mon, 27 Jan 2020 18:46:36 -0800 Subject: [PATCH] Call pytest using "python -m pytest" Directly calling "pytest" sometimes breaks tests on "pypy", such as #234, because the actual current code is untested. As explained from pypy website : > ["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. --- noxfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index e85ef43a1..d3e826fb5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -21,7 +21,9 @@ def coverage(*args): coverage("report", "-m", "--fail-under", "100") else: # Don't do coverage tracking for PyPy, since it's SLOW. - session.run("pytest", "--capture=no", "--strict", *session.posargs) + session.run( + "python", "-m", "pytest", "--capture=no", "--strict", *session.posargs + ) @nox.session(python="3.8")