Skip to content

Commit

Permalink
Now always clearing the cache in the nox file before running pytest, …
Browse files Browse the repository at this point in the history
…to avoid cross-env pollution
  • Loading branch information
Sylvain MARIE committed May 7, 2021
1 parent 32a6891 commit bf7dcb4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ def tests(session: PowerSession, coverage, pkg_specs):
# finally run all tests
if not coverage:
# simple: pytest only
session.run2("python -m pytest -v %s/tests/" % pkg_name)
session.run2("python -m pytest --cache-clear -v %s/tests/" % pkg_name)
else:
# coverage + junit html reports + badge generation
session.install_reqs(phase="coverage", phase_reqs=["coverage", "pytest-html", "requests", "xunitparser"],
versions_dct=pkg_specs)

# --coverage + junit html reports
session.run2("coverage run --source {pkg_name} "
"-m pytest --junitxml={dst}/junit.xml --html={dst}/report.html -v {pkg_name}/tests/"
"-m pytest --cache-clear --junitxml={dst}/junit.xml --html={dst}/report.html -v {pkg_name}/tests/"
"".format(pkg_name=pkg_name, dst=Folders.test_reports))
# session.run2("coverage report") # this shows in terminal + fails under XX%, same as --cov-report term --cov-fail-under=70 # noqa
session.run2("coverage xml -o {covxml}".format(covxml=Folders.coverage_xml))
Expand Down

0 comments on commit bf7dcb4

Please sign in to comment.