diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-11-03 11:52:58 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-11-03 11:52:58 (GMT) |
commit | 69032c81aaad1eaff7b58d5cbf9e51537e135c55 (patch) | |
tree | 6c829cd61d4068265f8f0cecf75753242009d374 /Lib/test/test_cmd_line.py | |
parent | 683b46aa8df73c41ccafdfe5909a466c1616cc20 (diff) | |
download | cpython-69032c81aaad1eaff7b58d5cbf9e51537e135c55.zip cpython-69032c81aaad1eaff7b58d5cbf9e51537e135c55.tar.gz cpython-69032c81aaad1eaff7b58d5cbf9e51537e135c55.tar.bz2 |
Issue #16309: Make PYTHONPATH= behavior the same as if PYTHONPATH not set at all.
Thanks to Armin Rigo and Alexey Kachayev.
Diffstat (limited to 'Lib/test/test_cmd_line.py')
-rw-r--r-- | Lib/test/test_cmd_line.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 7644db2..cbe1e55 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -216,6 +216,23 @@ class CmdLineTest(unittest.TestCase): self.assertIn(path1.encode('ascii'), out) self.assertIn(path2.encode('ascii'), out) + def test_empty_PYTHONPATH_issue16309(self): + """On Posix, it is documented that setting PATH to the + empty string is equivalent to not setting PATH at all, + which is an exception to the rule that in a string like + "/bin::/usr/bin" the empty string in the middle gets + interpreted as '.'""" + code = """if 1: + import sys + path = ":".join(sys.path) + path = path.encode("ascii", "backslashreplace") + sys.stdout.buffer.write(path)""" + rc1, out1, err1 = assert_python_ok('-c', code, PYTHONPATH="") + rc2, out2, err2 = assert_python_ok('-c', code) + # regarding to Posix specification, outputs should be equal + # for empty and unset PYTHONPATH + self.assertEquals(out1, out2) + def test_displayhook_unencodable(self): for encoding in ('ascii', 'latin-1', 'utf-8'): env = os.environ.copy() |