Lines Matching full:sys
3 Tests assume the initial paths in sys.path once the interpreter has begun
22 import sys
33 if sys.flags.no_site:
45 OLD_SYS_PATH = sys.path[:]
51 # modify sys.path: will be restored by tearDownModule()
59 sys.path[:] = OLD_SYS_PATH
67 """Save a copy of sys.path"""
68 self.sys_path = sys.path[:]
76 """Restore sys.path"""
77 sys.path[:] = self.sys_path
102 for entry in [site.makepath(path)[1] for path in sys.path
105 "%s from sys.path not found in set returned "
110 self.assertIn(pth_file.imported, sys.modules,
111 "%s not in sys.modules" % pth_file.imported)
112 self.assertIn(site.makepath(pth_file.good_dir_path)[0], sys.path)
117 # adds directories to sys.path for any line in the file that is not a
180 for path in sys.path:
204 if sys.platform == 'darwin' and sys._framework:
216 self.assertIn(usersite, sys.path)
219 rc = subprocess.call([sys.executable, '-c',
220 'import sys; sys.exit(%r in sys.path)' % usersite],
225 rc = subprocess.call([sys.executable, '-s', '-c',
226 'import sys; sys.exit(%r in sys.path)' % usersite],
235 rc = subprocess.call([sys.executable, '-c',
236 'import sys; sys.exit(%r in sys.path)' % usersite],
246 rc = subprocess.call([sys.executable, '-c',
247 'import sys, site; sys.exit(site.USER_BASE.startswith("/tmp"))'],
286 if sys.platlibdir != "lib":
288 wanted = os.path.join('xoxo', sys.platlibdir,
289 'python%d.%d' % sys.version_info[:2],
295 'python%d.%d' % sys.version_info[:2],
330 # addusersitepackages() must not add user_site to sys.path
342 with mock.patch('sys.flags', mock.Mock(verbose=verbose)), \
343 mock.patch('sys.stderr', io.StringIO()):
345 self.assertEqual(sys.stderr.getvalue(), out)
387 sys.modules, and that both self.good_dirname and self.bad_dirname are
392 self.imported_module = sys.modules.get(self.imported)
394 del sys.modules[self.imported]
397 sys.modules[self.imported] = self.imported_module
407 """Make a copy of sys.path"""
408 self.sys_path = sys.path[:]
411 """Restore sys.path"""
412 sys.path[:] = self.sys_path
421 sys.modules['test'].__cached__ = None
423 self.assertIsNone(sys.modules['test'].__cached__)
426 # No duplicate paths should exist in sys.path
430 for path in sys.path:
457 if sys.platform == "win32":
468 if "sitecustomize" not in sys.modules:
499 # Get sys.path in isolated mode (python3 -I)
500 popen = subprocess.Popen([sys.executable, '-I', '-c',
501 'import sys; print(repr(sys.path))'],
509 # found in sys.path (see site.addpackage()). Skip the test if at least
518 popen = subprocess.Popen([sys.executable, '-I', '-v', '-c',
519 'import sys; print(set(sys.modules))'],
543 }.difference(sys.builtin_module_names)
547 r = subprocess.Popen([sys.executable, '-c',
548 'import sys; sys.exit(hasattr(sys, "__interactivehook__"))']).wait()
553 r = subprocess.Popen([sys.executable, '-I', '-c',
554 'import sys; sys.exit(hasattr(sys, "__interactivehook__"))']).wait()
559 r = subprocess.Popen([sys.executable, '-I', '-c',
560 …'import site, sys; site.enablerlcompleter(); sys.exit(hasattr(sys, "__interactivehook__"))']).wait…
563 @unittest.skipUnless(sys.platform == 'win32', "only supported on Windows")
570 exe_file = os.path.join(temp_dir, os.path.split(sys.executable)[1])
571 dll_src_file = _winapi.GetModuleFileName(sys.dllhandle)
573 shutil.copy(sys.executable, exe_file)
595 exe_prefix = os.path.dirname(sys.executable)
611 'import sys; print("\\n".join(sys.path) if sys.flags.no_site else "")'
614 self.assertTrue(actual_sys_path, "sys.flags.no_site was False")
618 "sys.path is incorrect"
623 exe_prefix = os.path.dirname(sys.executable)
636 'import sys; sys.exit(not sys.flags.no_site and '
637 '%r in sys.path and %r in sys.path and %r not in sys.path and '
638 'all("\\r" not in p and "\\n" not in p for p in sys.path))' % (
643 self.assertTrue(rc, "sys.path is incorrect")
648 exe_prefix = os.path.dirname(sys.executable)
661 'import sys; sys.exit(not sys.flags.no_site and '
662 '%r in sys.path and %r in sys.path and %r not in sys.path and '
663 'all("\\r" not in p and "\\n" not in p for p in sys.path))' % (
668 self.assertTrue(rc, "sys.path is incorrect")