diff options
author | Victor Stinner <vstinner@python.org> | 2022-05-06 01:41:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 01:41:24 (GMT) |
commit | 329afe78c3bbc234492a53f7a4084d07e215a077 (patch) | |
tree | 281fa4038479d8d6e92bfa1da96ce18aca56a8f5 /Lib/test/test_cmd_line_script.py | |
parent | 1303f8c927227b72d9ee9eae890be4692b4d4592 (diff) | |
download | cpython-329afe78c3bbc234492a53f7a4084d07e215a077.zip cpython-329afe78c3bbc234492a53f7a4084d07e215a077.tar.gz cpython-329afe78c3bbc234492a53f7a4084d07e215a077.tar.bz2 |
gh-57684: Update tests for PYTHONSAFEPATH=1 (#92358)
Fix tests failing with the PYTHONSAFEPATH=1 env var.
Enhance also -P help in Python usage (python --help).
Diffstat (limited to 'Lib/test/test_cmd_line_script.py')
-rw-r--r-- | Lib/test/test_cmd_line_script.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py index 9fe748c..bb433dc 100644 --- a/Lib/test/test_cmd_line_script.py +++ b/Lib/test/test_cmd_line_script.py @@ -116,7 +116,9 @@ class CmdLineTest(unittest.TestCase): self.assertIn(printed_file.encode('utf-8'), data) self.assertIn(printed_package.encode('utf-8'), data) self.assertIn(printed_argv0.encode('utf-8'), data) - self.assertIn(printed_path0.encode('utf-8'), data) + # PYTHONSAFEPATH=1 changes the default sys.path[0] + if not sys.flags.safe_path: + self.assertIn(printed_path0.encode('utf-8'), data) self.assertIn(printed_cwd.encode('utf-8'), data) def _check_script(self, script_exec_args, expected_file, |