Skip to content

Commit ded8302

Browse files
committed
Add unit test
1 parent 58eb3f2 commit ded8302

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Lib/test/test_cmd_line.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,14 @@ def test_presite(self):
13141314
proc = assert_python_ok("-X", f"presite={entrypoint}", "-c", "pass")
13151315
self.assertEqual(proc.out.rstrip(), b"presite func")
13161316

1317+
def test_dump_path_config(self):
1318+
# gh-151253: At the first import (import encodings) during Python
1319+
# startup, if the import fails, dump the Python path configuration.
1320+
nonexistent = '/nonexistent-python-path'
1321+
proc = assert_python_failure("-c", "pass", PYTHONHOME=nonexistent)
1322+
self.assertIn(b'Python path configuration:', proc.err)
1323+
self.assertIn(f"PYTHONHOME = '{nonexistent}'".encode(), proc.err)
1324+
13171325

13181326
@unittest.skipIf(interpreter_requires_environment(),
13191327
'Cannot run -I tests when PYTHON env vars are required.')

0 commit comments

Comments
 (0)