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

Method test_init_pybuilddir_win32

Lib/test/test_embed.py:1641–1679  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1639
1640 @unittest.skipUnless(MS_WINDOWS, 'See test_init_pybuilddir')
1641 def test_init_pybuilddir_win32(self):
1642 # Test path configuration with pybuilddir.txt configuration file
1643
1644 vpath = sysconfig.get_config_var("VPATH")
1645 subdir = r'PCbuild\arch'
1646 if os.path.normpath(vpath).count(os.sep) == 2:
1647 subdir = os.path.join(subdir, 'instrumented')
1648
1649 with self.tmpdir_with_python(subdir) as tmpdir:
1650 # The prefix is dirname(executable) + VPATH
1651 prefix = os.path.normpath(os.path.join(tmpdir, vpath))
1652 # The stdlib dir is dirname(executable) + VPATH + 'Lib'
1653 stdlibdir = os.path.normpath(os.path.join(tmpdir, vpath, 'Lib'))
1654 os.mkdir(stdlibdir)
1655
1656 filename = os.path.join(tmpdir, 'pybuilddir.txt')
1657 with open(filename, "w", encoding="utf8") as fp:
1658 fp.write(tmpdir)
1659
1660 module_search_paths = self.module_search_paths()
1661 module_search_paths[-3] = os.path.join(tmpdir, os.path.basename(module_search_paths[-3]))
1662 module_search_paths[-2] = tmpdir
1663 module_search_paths[-1] = stdlibdir
1664
1665 executable = self.test_exe
1666 config = {
1667 'base_exec_prefix': prefix,
1668 'base_prefix': prefix,
1669 'base_executable': executable,
1670 'executable': executable,
1671 'prefix': prefix,
1672 'exec_prefix': prefix,
1673 'module_search_paths': module_search_paths,
1674 'stdlib_dir': stdlibdir,
1675 }
1676 env = self.copy_paths_by_env(config)
1677 self.check_all_configs("test_init_compat_config", config,
1678 api=API_COMPAT, env=env,
1679 ignore_stderr=False, cwd=tmpdir)
1680
1681 def test_init_pyvenv_cfg(self):
1682 # Test path configuration with pyvenv.cfg configuration file

Callers

nothing calls this directly

Calls 10

tmpdir_with_pythonMethod · 0.95
module_search_pathsMethod · 0.95
copy_paths_by_envMethod · 0.95
check_all_configsMethod · 0.95
openFunction · 0.50
countMethod · 0.45
joinMethod · 0.45
mkdirMethod · 0.45
writeMethod · 0.45
basenameMethod · 0.45

Tested by

no test coverage detected