• Home
  • Raw
  • Download

Lines Matching full:sys

3 Tests assume the initial paths in sys.path once the interpreter has begun
23 import sys
34 if sys.flags.no_site:
46 OLD_SYS_PATH = sys.path[:]
52 # modify sys.path: will be restored by tearDownModule()
60 sys.path[:] = OLD_SYS_PATH
68 """Save a copy of sys.path"""
69 self.sys_path = sys.path[:]
77 """Restore sys.path"""
78 sys.path[:] = self.sys_path
103 for entry in [site.makepath(path)[1] for path in sys.path
106 "%s from sys.path not found in set returned "
111 self.assertIn(pth_file.imported, sys.modules,
112 "%s not in sys.modules" % pth_file.imported)
113 self.assertIn(site.makepath(pth_file.good_dir_path)[0], sys.path)
118 # adds directories to sys.path for any line in the file that is not a
181 for path in sys.path:
205 if sys.platform == 'darwin' and sys._framework:
218 self.assertIn(usersite, sys.path)
221 rc = subprocess.call([sys.executable, '-c',
222 'import sys; sys.exit(%r in sys.path)' % usersite],
227 rc = subprocess.call([sys.executable, '-s', '-c',
228 'import sys; sys.exit(%r in sys.path)' % usersite],
237 rc = subprocess.call([sys.executable, '-c',
238 'import sys; sys.exit(%r in sys.path)' % usersite],
248 rc = subprocess.call([sys.executable, '-c',
249 'import sys, site; sys.exit(site.USER_BASE.startswith("/tmp"))'],
288 if sys.platlibdir != "lib":
290 wanted = os.path.join('xoxo', sys.platlibdir,
291 'python%d.%d' % sys.version_info[:2],
297 'python%d.%d' % sys.version_info[:2],
333 # addusersitepackages() must not add user_site to sys.path
345 with mock.patch('sys.flags', mock.Mock(verbose=verbose)), \
346 mock.patch('sys.stderr', io.StringIO()):
348 self.assertEqual(sys.stderr.getvalue(), out)
390 sys.modules, and that both self.good_dirname and self.bad_dirname are
395 self.imported_module = sys.modules.get(self.imported)
397 del sys.modules[self.imported]
400 sys.modules[self.imported] = self.imported_module
410 """Make a copy of sys.path"""
411 self.sys_path = sys.path[:]
414 """Restore sys.path"""
415 sys.path[:] = self.sys_path
424 sys.modules['test'].__cached__ = None
426 self.assertIsNone(sys.modules['test'].__cached__)
429 # No duplicate paths should exist in sys.path
433 for path in sys.path:
461 if "sitecustomize" not in sys.modules:
493 # Get sys.path in isolated mode (python3 -I)
494 popen = subprocess.Popen([sys.executable, '-X', 'utf8', '-I',
495 '-c', 'import sys; print(repr(sys.path))'],
504 # found in sys.path (see site.addpackage()). Skip the test if at least
513 popen = subprocess.Popen([sys.executable, '-X', 'utf8', '-I', '-v',
514 '-c', 'import sys; print(set(sys.modules))'],
539 }.difference(sys.builtin_module_names)
544 r = subprocess.Popen([sys.executable, '-c',
545 'import sys; sys.exit(hasattr(sys, "__interactivehook__"))']).wait()
551 r = subprocess.Popen([sys.executable, '-I', '-c',
552 'import sys; sys.exit(hasattr(sys, "__interactivehook__"))']).wait()
558 r = subprocess.Popen([sys.executable, '-I', '-c',
559 …'import site, sys; site.enablerlcompleter(); sys.exit(hasattr(sys, "__interactivehook__"))']).wait…
564 if sys.platform == 'win32':
569 exe_file = os.path.join(temp_dir, os.path.split(sys.executable)[1])
570 dll_src_file = _winapi.GetModuleFileName(sys.dllhandle)
572 shutil.copy(sys.executable, exe_file)
590 exe_file = os.path.join(temp_dir, os.path.split(sys.executable)[1])
591 os.symlink(sys.executable, exe_file)
610 exe_prefix = os.path.dirname(sys.executable)
611 pth_lines = ['#.', '# ..', *sys.path, '.', '..']
618 'import sys; print("\\n".join(sys.path) if sys.flags.no_site else "")'
621 self.assertTrue(actual_sys_path, "sys.flags.no_site was False")
625 "sys.path is incorrect"
631 exe_prefix = os.path.dirname(sys.executable)
647 'import sys; print("\\n".join(sys.path) if sys.flags.no_site else "")'
650 self.assertTrue(actual_sys_path, "sys.flags.no_site was False")
654 "sys.path is incorrect"
660 exe_prefix = os.path.dirname(sys.executable)
673 'import sys; sys.exit(not sys.flags.no_site and '
674 '%r in sys.path and %r in sys.path and %r not in sys.path and '
675 'all("\\r" not in p and "\\n" not in p for p in sys.path))' % (
680 self.assertTrue(rc, "sys.path is incorrect")
685 exe_prefix = os.path.dirname(sys.executable)
698 'import sys; sys.exit(not sys.flags.no_site and '
699 '%r in sys.path and %r in sys.path and %r not in sys.path and '
700 'all("\\r" not in p and "\\n" not in p for p in sys.path))' % (
705 self.assertTrue(rc, "sys.path is incorrect")