@@ -39,3 +39,30 @@ def test_custom_interpreter(
39
39
if sys .version_info >= (3 , 12 ):
40
40
expected -= {"setuptools" , "wheel" }
41
41
assert found == expected , out
42
+
43
+
44
+ def test_custom_interpreter_with_local_only (
45
+ tmp_path : Path ,
46
+ monkeypatch : pytest .MonkeyPatch ,
47
+ capfd : pytest .CaptureFixture [str ],
48
+ ) -> None :
49
+ venv_path = str (tmp_path / "venv" )
50
+
51
+ result = virtualenv .cli_run ([venv_path , "--system-site-packages" , "--activators" , "" ])
52
+
53
+ cmd = ["" , f"--python={ result .creator .exe } " , "--local-only" ]
54
+ monkeypatch .setattr (sys , "prefix" , venv_path )
55
+ monkeypatch .setattr (sys , "argv" , cmd )
56
+ main ()
57
+ out , _ = capfd .readouterr ()
58
+ found = {i .split ("==" )[0 ] for i in out .splitlines ()}
59
+ implementation = python_implementation ()
60
+ if implementation == "CPython" :
61
+ expected = {"pip" , "setuptools" , "wheel" }
62
+ elif implementation == "PyPy" : # pragma: no cover
63
+ expected = {"cffi" , "greenlet" , "pip" , "readline" , "setuptools" , "wheel" } # pragma: no cover
64
+ else :
65
+ raise ValueError (implementation ) # pragma: no cover
66
+ if sys .version_info >= (3 , 12 ):
67
+ expected -= {"setuptools" , "wheel" } # pragma: no cover
68
+ assert found == expected , out
0 commit comments