Skip to content

Commit e3d8578

Browse files
authored
tests: support running when the Python launcher for UNIX is present (#775)
1 parent ddea973 commit e3d8578

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tests/test_virtualenv.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_process_env_constructor():
103103
with pytest.raises(
104104
ValueError, match=r"^The environment does not have a bin directory\.$"
105105
):
106-
penv.bin # noqa: B018
106+
print(penv.bin)
107107

108108
penv = nox.virtualenv.ProcessEnv(env={"SIGIL": "123"})
109109
assert penv.env["SIGIL"] == "123"
@@ -561,7 +561,7 @@ def test__resolved_interpreter_invalid_numerical_id(which, make_one, input_):
561561
venv, _ = make_one(interpreter=input_)
562562

563563
with pytest.raises(nox.virtualenv.InterpreterNotFound):
564-
venv._resolved_interpreter # noqa: B018
564+
print(venv._resolved_interpreter)
565565

566566
which.assert_called_once_with(input_)
567567

@@ -572,7 +572,7 @@ def test__resolved_interpreter_32_bit_non_windows(which, make_one):
572572
venv, _ = make_one(interpreter="3.6-32")
573573

574574
with pytest.raises(nox.virtualenv.InterpreterNotFound):
575-
venv._resolved_interpreter # noqa: B018
575+
print(venv._resolved_interpreter)
576576
which.assert_called_once_with("3.6-32")
577577

578578

@@ -654,7 +654,7 @@ def special_run(cmd, *args, **kwargs):
654654

655655
# Okay now run the test.
656656
with pytest.raises(nox.virtualenv.InterpreterNotFound):
657-
venv._resolved_interpreter # noqa: B018
657+
print(venv._resolved_interpreter)
658658

659659
which.assert_has_calls([mock.call("python3.6"), mock.call("py")])
660660

@@ -700,7 +700,7 @@ def test__resolved_interpreter_windows_path_and_version_fails(
700700
patch_sysfind(("python", "python.exe"), sysfind_result, sysexec_result)
701701

702702
with pytest.raises(nox.virtualenv.InterpreterNotFound):
703-
venv._resolved_interpreter # noqa: B018
703+
print(venv._resolved_interpreter)
704704

705705

706706
@mock.patch("nox.virtualenv._SYSTEM", new="Windows")
@@ -715,17 +715,18 @@ def test__resolved_interpreter_not_found(which, make_one):
715715

716716
# Run the test.
717717
with pytest.raises(nox.virtualenv.InterpreterNotFound):
718-
venv._resolved_interpreter # noqa: B018
718+
print(venv._resolved_interpreter)
719719

720720

721721
@mock.patch("nox.virtualenv._SYSTEM", new="Windows")
722+
@mock.patch("nox.virtualenv.locate_via_py", new=lambda _: None)
722723
def test__resolved_interpreter_nonstandard(make_one):
723724
# Establish that we do not try to resolve non-standard locations
724725
# on Windows.
725726
venv, _ = make_one(interpreter="goofy")
726727

727728
with pytest.raises(nox.virtualenv.InterpreterNotFound):
728-
venv._resolved_interpreter # noqa: B018
729+
print(venv._resolved_interpreter)
729730

730731

731732
@mock.patch("nox.virtualenv._SYSTEM", new="Linux")
@@ -749,12 +750,12 @@ def test__resolved_interpreter_cache_failure(which, make_one):
749750

750751
assert venv._resolved is None
751752
with pytest.raises(nox.virtualenv.InterpreterNotFound) as exc_info:
752-
venv._resolved_interpreter # noqa: B018
753+
print(venv._resolved_interpreter)
753754
caught = exc_info.value
754755

755756
which.assert_called_once_with("3.7-32")
756757
# Check the cache and call again to make sure it is used.
757758
assert venv._resolved is caught
758759
with pytest.raises(nox.virtualenv.InterpreterNotFound):
759-
venv._resolved_interpreter # noqa: B018
760+
print(venv._resolved_interpreter)
760761
assert which.call_count == 1

0 commit comments

Comments
 (0)