(self)
| 746 | @unittest.expectedFailure # TODO: RUSTPYTHON |
| 747 | @support.requires_subprocess() |
| 748 | def test_underpth_nosite_file(self): |
| 749 | libpath = test.support.STDLIB_DIR |
| 750 | exe_prefix = os.path.dirname(sys.executable) |
| 751 | pth_lines = self._get_pth_lines(libpath, import_site=False) |
| 752 | exe_file = self._create_underpth_exe(pth_lines) |
| 753 | sys_path = self._calc_sys_path_for_underpth_nosite( |
| 754 | os.path.dirname(exe_file), |
| 755 | pth_lines) |
| 756 | |
| 757 | env = os.environ.copy() |
| 758 | env['PYTHONPATH'] = 'from-env' |
| 759 | env['PATH'] = '{}{}{}'.format(exe_prefix, os.pathsep, os.getenv('PATH')) |
| 760 | output = subprocess.check_output([exe_file, '-c', |
| 761 | 'import sys; print("\\n".join(sys.path) if sys.flags.no_site else "")' |
| 762 | ], env=env, encoding='utf-8', errors='surrogateescape') |
| 763 | actual_sys_path = output.rstrip().split('\n') |
| 764 | self.assertTrue(actual_sys_path, "sys.flags.no_site was False") |
| 765 | self.assertEqual( |
| 766 | actual_sys_path, |
| 767 | sys_path, |
| 768 | "sys.path is incorrect" |
| 769 | ) |
| 770 | |
| 771 | @unittest.expectedFailure # TODO: RUSTPYTHON |
| 772 | @support.requires_subprocess() |
nothing calls this directly
no test coverage detected