(self)
| 731 | |
| 732 | @support.requires_subprocess() |
| 733 | def test_underpth_nosite_file(self): |
| 734 | libpath = test.support.STDLIB_DIR |
| 735 | exe_prefix = os.path.dirname(sys.executable) |
| 736 | pth_lines = self._get_pth_lines(libpath, import_site=False) |
| 737 | exe_file = self._create_underpth_exe(pth_lines) |
| 738 | sys_path = self._calc_sys_path_for_underpth_nosite( |
| 739 | os.path.dirname(exe_file), |
| 740 | pth_lines) |
| 741 | |
| 742 | env = os.environ.copy() |
| 743 | env['PYTHONPATH'] = 'from-env' |
| 744 | env['PATH'] = '{}{}{}'.format(exe_prefix, os.pathsep, os.getenv('PATH')) |
| 745 | output = subprocess.check_output([exe_file, '-c', |
| 746 | 'import sys; print("\\n".join(sys.path) if sys.flags.no_site else "")' |
| 747 | ], env=env, encoding='utf-8', errors='surrogateescape') |
| 748 | actual_sys_path = output.rstrip().split('\n') |
| 749 | self.assertTrue(actual_sys_path, "sys.flags.no_site was False") |
| 750 | self.assertEqual( |
| 751 | actual_sys_path, |
| 752 | sys_path, |
| 753 | "sys.path is incorrect" |
| 754 | ) |
| 755 | |
| 756 | @support.requires_subprocess() |
| 757 | def test_underpth_file(self): |
nothing calls this directly
no test coverage detected