MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_sysconfig_symlinks

Method test_sysconfig_symlinks

Lib/test/test_venv.py:321–352  ·  view source on GitHub ↗

Test that the sysconfig functions work in a virtual environment.

(self)

Source from the content-addressed store, hash-verified

319 @requireVenvCreate
320 @unittest.skipUnless(can_symlink(), 'Needs symlinks')
321 def test_sysconfig_symlinks(self):
322 """
323 Test that the sysconfig functions work in a virtual environment.
324 """
325 rmtree(self.env_dir)
326 self.run_with_capture(venv.create, self.env_dir, symlinks=True)
327 cmd = [self.envpy(), '-c', None]
328 for call, expected in (
329 # installation scheme
330 ('get_preferred_scheme("prefix")', 'venv'),
331 ('get_default_scheme()', 'venv'),
332 # build environment
333 ('is_python_build()', str(sysconfig.is_python_build())),
334 ('get_makefile_filename()', sysconfig.get_makefile_filename()),
335 ('get_config_h_filename()', sysconfig.get_config_h_filename()),
336 ('get_config_var("Py_GIL_DISABLED")',
337 str(sysconfig.get_config_var("Py_GIL_DISABLED")))):
338 with self.subTest(call):
339 cmd[2] = 'import sysconfig; print(sysconfig.%s)' % call
340 out, err = check_output(cmd, encoding='utf-8')
341 self.assertEqual(out.strip(), expected, err)
342 for attr, expected in (
343 ('executable', self.envpy()),
344 # Usually compare to sys.executable, but if we're running in our own
345 # venv then we really need to compare to our base executable
346 # HACK: Test fails on POSIX with unversioned binary (PR gh-113033)
347 #('_base_executable', sys._base_executable),
348 ):
349 with self.subTest(attr):
350 cmd[2] = f'import sys; print(sys.{attr})'
351 out, err = check_output(cmd, encoding='utf-8')
352 self.assertEqual(out.strip(), expected, err)
353
354 if sys.platform == 'win32':
355 ENV_SUBDIRS = (

Callers

nothing calls this directly

Calls 8

rmtreeFunction · 0.90
strFunction · 0.85
run_with_captureMethod · 0.80
envpyMethod · 0.80
subTestMethod · 0.80
check_outputFunction · 0.70
assertEqualMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected