MCPcopy Index your code
hub / github.com/python/cpython / test_prefixes

Method test_prefixes

Lib/test/test_venv.py:262–278  ·  view source on GitHub ↗

Test that the prefix values are as expected.

(self)

Source from the content-addressed store, hash-verified

260
261 @requireVenvCreate
262 def test_prefixes(self):
263 """
264 Test that the prefix values are as expected.
265 """
266 # check a venv's prefixes
267 rmtree(self.env_dir)
268 self.run_with_capture(venv.create, self.env_dir)
269 cmd = [self.envpy(), '-c', None]
270 for prefix, expected in (
271 ('prefix', self.env_dir),
272 ('exec_prefix', self.env_dir),
273 ('base_prefix', sys.base_prefix),
274 ('base_exec_prefix', sys.base_exec_prefix)):
275 cmd[2] = 'import sys; print(sys.%s)' % prefix
276 out, err = check_output(cmd)
277 self.assertEqual(pathlib.Path(out.strip().decode()),
278 pathlib.Path(expected), prefix)
279
280 @requireVenvCreate
281 def test_sysconfig(self):

Callers

nothing calls this directly

Calls 7

rmtreeFunction · 0.90
run_with_captureMethod · 0.80
envpyMethod · 0.80
check_outputFunction · 0.70
assertEqualMethod · 0.45
decodeMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected