mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-120037: Disable user site packages when a ._pth file is used (GH-137428)
This commit is contained in:
parent
e39255e76d
commit
7d06a0af17
4 changed files with 19 additions and 0 deletions
|
|
@ -804,6 +804,15 @@ def test_underpth_dll_file(self):
|
|||
)], env=env)
|
||||
self.assertTrue(rc, "sys.path is incorrect")
|
||||
|
||||
@support.requires_subprocess()
|
||||
def test_underpth_no_user_site(self):
|
||||
pth_lines = [test.support.STDLIB_DIR, 'import site']
|
||||
exe_file = self._create_underpth_exe(pth_lines)
|
||||
p = subprocess.run([exe_file, '-X', 'utf8', '-c',
|
||||
'import sys; '
|
||||
'sys.exit(not sys.flags.no_user_site)'])
|
||||
self.assertEqual(p.returncode, 0, "sys.flags.no_user_site was 0")
|
||||
|
||||
|
||||
class CommandLineTests(unittest.TestCase):
|
||||
def exists(self, path):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue