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

Method test_underpth_file

Lib/test/test_site.py:757–774  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

755
756 @support.requires_subprocess()
757 def test_underpth_file(self):
758 libpath = test.support.STDLIB_DIR
759 exe_prefix = os.path.dirname(sys.executable)
760 exe_file = self._create_underpth_exe(
761 self._get_pth_lines(libpath, import_site=True))
762 sys_prefix = os.path.dirname(exe_file)
763 env = os.environ.copy()
764 env['PYTHONPATH'] = 'from-env'
765 env['PATH'] = '{};{}'.format(exe_prefix, os.getenv('PATH'))
766 rc = subprocess.call([exe_file, '-c',
767 'import sys; sys.exit(not sys.flags.no_site and '
768 '%r in sys.path and %r in sys.path and %r not in sys.path and '
769 'all("\\r" not in p and "\\n" not in p for p in sys.path))' % (
770 os.path.join(sys_prefix, 'fake-path-name'),
771 libpath,
772 os.path.join(sys_prefix, 'from-env'),
773 )], env=env)
774 self.assertTrue(rc, "sys.path is incorrect")
775
776 @support.requires_subprocess()
777 def test_underpth_dll_file(self):

Callers

nothing calls this directly

Calls 8

_create_underpth_exeMethod · 0.95
_get_pth_linesMethod · 0.95
assertTrueMethod · 0.80
dirnameMethod · 0.45
copyMethod · 0.45
formatMethod · 0.45
callMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected