Skip to content

Commit

Permalink
Improve automated tests support on Windows (#300)
Browse files Browse the repository at this point in the history
* Allow sphinx-autobuild to run on Windows

* Improve coverage when selecting bin folder

* Test CondaEnv interpreter on Windows

* Test VirtualEnv interpreter on Windows

* Merge coverage results.

* Undo changes to `test_create_interpreter`.

* Remove an unused shutil import
  • Loading branch information
Peilonrayz committed Mar 8, 2021
1 parent 7ad30a0 commit 082c266
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
11 changes: 9 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ def tests(session):
session.run("pytest", *tests)
return
session.run(
"pytest", "--cov=nox", "--cov-config", ".coveragerc", "--cov-report=", *tests
"pytest",
"--cov=nox",
"--cov-config",
".coveragerc",
"--cov-report=",
*tests,
env={"COVERAGE_FILE": ".coverage.{}".format(session.python)}
)
session.notify("cover")

Expand All @@ -65,6 +71,7 @@ def cover(session):
return

session.install("coverage")
session.run("coverage", "combine")
session.run("coverage", "report", "--fail-under=100", "--show-missing")
session.run("coverage", "erase")

Expand Down Expand Up @@ -94,7 +101,7 @@ def lint(session):
session.run("flake8", "nox", *files)


@nox.session(python="3.8")
@nox.session(python="3.7")
def docs(session):
"""Build the documentation."""
output_dir = os.path.join(session.create_tmp(), "output")
Expand Down
11 changes: 8 additions & 3 deletions tests/test_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,18 @@ def test_condaenv_create(make_conda):
assert dir_.join("test.txt").check()


@pytest.mark.skipif(IS_WINDOWS, reason="Not testing multiple interpreters on Windows.")
@pytest.mark.skipif(not HAS_CONDA, reason="Missing conda command.")
def test_condaenv_create_interpreter(make_conda):
venv, dir_ = make_conda(interpreter="3.7")
venv.create()
assert dir_.join("bin", "python").check()
assert dir_.join("bin", "python3.7").check()
if IS_WINDOWS:
assert dir_.join("python.exe").check()
assert dir_.join("python37.dll").check()
assert dir_.join("python37.pdb").check()
assert not dir_.join("python37.exe").check()
else:
assert dir_.join("bin", "python").check()
assert dir_.join("bin", "python3.7").check()


@mock.patch("nox.virtualenv._SYSTEM", new="Windows")
Expand Down

0 comments on commit 082c266

Please sign in to comment.