summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cmd_line_script.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-12-09 16:34:02 (GMT)
committerGitHub <noreply@github.com>2019-12-09 16:34:02 (GMT)
commita1a99b4bb7cbe2dbc55a1d92c3c509b4466d3c3b (patch)
treeffc1e3e7fc999d447331fb9cfd9d1cebf10177b2 /Lib/test/test_cmd_line_script.py
parentd219cc4180e7589807ebbef7421879f095e72a98 (diff)
downloadcpython-a1a99b4bb7cbe2dbc55a1d92c3c509b4466d3c3b.zip
cpython-a1a99b4bb7cbe2dbc55a1d92c3c509b4466d3c3b.tar.gz
cpython-a1a99b4bb7cbe2dbc55a1d92c3c509b4466d3c3b.tar.bz2
bpo-20443: No longer make sys.argv[0] absolute for script (GH-17534)
In Python 3.9.0a1, sys.argv[0] was made an asolute path if a filename was specified on the command line. Revert this change, since most users expect sys.argv to be unmodified.
Diffstat (limited to 'Lib/test/test_cmd_line_script.py')
-rw-r--r--Lib/test/test_cmd_line_script.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index 2ac926d..adfb8ce 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -223,12 +223,13 @@ class CmdLineTest(unittest.TestCase):
def test_script_abspath(self):
# pass the script using the relative path, expect the absolute path
- # in __file__ and sys.argv[0]
+ # in __file__
with support.temp_cwd() as script_dir:
self.assertTrue(os.path.isabs(script_dir), script_dir)
script_name = _make_test_script(script_dir, 'script')
- self._check_script(os.path.basename(script_name), script_name, script_name,
+ relative_name = os.path.basename(script_name)
+ self._check_script(relative_name, script_name, relative_name,
script_dir, None,
importlib.machinery.SourceFileLoader)