mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Call coverage
or pytest
using python -m
This has the desired side effect to add the current directory to `sys.path`
This commit is contained in:
parent
a5b2b6c350
commit
d3dbe0b39d
1 changed files with 8 additions and 4 deletions
12
noxfile.py
12
noxfile.py
|
@ -889,9 +889,11 @@ def _pytest(session, coverage, cmd_args):
|
|||
|
||||
try:
|
||||
if coverage is True:
|
||||
_run_with_coverage(session, "coverage", "run", "-m", "pytest", *cmd_args)
|
||||
_run_with_coverage(
|
||||
session, "python", "-m", "coverage", "run", "-m", "pytest", *cmd_args
|
||||
)
|
||||
else:
|
||||
session.run("pytest", *cmd_args, env=env)
|
||||
session.run("python", "-m", "pytest", *cmd_args, env=env)
|
||||
except CommandFailed: # pylint: disable=try-except-raise
|
||||
# Not rerunning failed tests for now
|
||||
raise
|
||||
|
@ -905,9 +907,11 @@ def _pytest(session, coverage, cmd_args):
|
|||
cmd_args[idx] = parg.replace(".xml", "-rerun-failed.xml")
|
||||
cmd_args.append("--lf")
|
||||
if coverage is True:
|
||||
_run_with_coverage(session, "coverage", "run", "-m", "pytest", *cmd_args)
|
||||
_run_with_coverage(
|
||||
session, "python", "-m", "coverage", "run", "-m", "pytest", *cmd_args
|
||||
)
|
||||
else:
|
||||
session.run("pytest", *cmd_args, env=env)
|
||||
session.run("python", "-m", "pytest", *cmd_args, env=env)
|
||||
# pylint: enable=unreachable
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue