MCPcopy
hub / github.com/pex-tool/pex / test_force

Function test_force

tests/tools/commands/test_venv.py:115–130  ·  view source on GitHub ↗
(create_pex_venv)

Source from the content-addressed store, hash-verified

113
114
115def test_force(create_pex_venv):
116 # type: (CreatePexVenv) -> None
117 venv = create_pex_venv("--pip")
118 venv.interpreter.execute(args=["-m", "pip", "install", "ansicolors==1.1.8"])
119 venv.interpreter.execute(args=["-c", "import colors"])
120
121 with pytest.raises(CalledProcessError):
122 create_pex_venv()
123
124 venv_force = create_pex_venv("--force")
125 # The re-created venv should have no ansicolors installed like the prior venv.
126 with pytest.raises(Executor.NonZeroExit):
127 venv_force.interpreter.execute(args=["-c", "import colors"])
128 # The re-created venv should have no pip installed either.
129 with pytest.raises(Executor.NonZeroExit):
130 venv.interpreter.execute(args=["-m", "pip", "install", "ansicolors==1.1.8"])
131
132
133def execute_venv_pex_interpreter(

Callers

nothing calls this directly

Calls 2

create_pex_venvFunction · 0.85
executeMethod · 0.45

Tested by

no test coverage detected