This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: removing pythonXY.zip from sys.path results in additional test failures
Type: enhancement Stage:
Components: Tests Versions: Python 3.4, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: doko, eric.snow, iritkatriel, ncoghlan
Priority: normal Keywords: patch

Created on 2014-04-15 22:16 by doko, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
no-zip-on-sys.path.diff doko, 2014-04-15 22:16
Messages (3)
msg216402 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2014-04-15 22:16
At least Linux distros never ship pythonXY.zip, so I'm removing it from sys.path to save the extra lookup for a file which never exists.  This did work in 2.x and 3.x up to 3.3.  In 3.4 it does cause additional test failures:

Re-running test 'test_cmd_line_script' in verbose mode
[...]
test_zipfile_compiled (test.test_cmd_line_script.CmdLineTest) ... ok
test_zipfile_error (test.test_cmd_line_script.CmdLineTest) ... FAIL

======================================================================
FAIL: test_directory_error (test.test_cmd_line_script.CmdLineTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/buildd/python3.4-3.4.0/Lib/test/test_cmd_line_script.py", line 213, in test_directory_error
    self._check_import_error(script_dir, msg)
  File "/build/buildd/python3.4-3.4.0/Lib/test/test_cmd_line_script.py", line 156, in _check_import_error
    self.assertIn(expected_msg.encode('utf-8'), err)
AssertionError: b"can't find '__main__' module in '/tmp/tmpc2iybbmi'" not found in b"Could not import runpy module\nImportError: No module named 'runpy'"

======================================================================
FAIL: test_zipfile_error (test.test_cmd_line_script.CmdLineTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/buildd/python3.4-3.4.0/Lib/test/test_cmd_line_script.py", line 235, in test_zipfile_error
    self._check_import_error(zip_name, msg)
  File "/build/buildd/python3.4-3.4.0/Lib/test/test_cmd_line_script.py", line 156, in _check_import_error
    self.assertIn(expected_msg.encode('utf-8'), err)
AssertionError: b"can't find '__main__' module in '/tmp/tmp34n7w8gj/test_zip.zip'" not found in b"Could not import runpy module\nImportError: No module named 'runpy'"

----------------------------------------------------------------------
Ran 24 tests in 1.906s

FAILED (failures=2)
test test_cmd_line_script failed

Re-running test 'test_zipimport_support' in verbose mode
test_doctest_issue4197 (test.test_zipimport_support.ZipSupportTests) ... ok
test_doctest_main_issue4197 (test.test_zipimport_support.ZipSupportTests) ... FAIL
test_inspect_getsource_issue4223 (test.test_zipimport_support.ZipSupportTests) ... ok
test_pdb_issue4201 (test.test_zipimport_support.ZipSupportTests) ... ok

======================================================================
FAIL: test_doctest_main_issue4197 (test.test_zipimport_support.ZipSupportTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/buildd/python3.4-3.4.0/Lib/test/test_zipimport_support.py", line 209, in test_doctest_main_issue4197
    rc, out, err = assert_python_ok(zip_name)
  File "/build/buildd/python3.4-3.4.0/Lib/test/script_helper.py", line 69, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
  File "/build/buildd/python3.4-3.4.0/Lib/test/script_helper.py", line 55, in _assert_python
    "stderr follows:\n%s" % (rc, err.decode('ascii', 'ignore')))
AssertionError: Process return code is 1, stderr follows:
Could not import runpy module
ImportError: No module named 'runpy'
msg216550 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2014-04-16 18:47
Brett mentioned this optimization might not be worth doing.  Exactly one stat call for the python zip file is saved.
msg404708 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-10-21 23:38
This seems abandoned. Shall we close?
History
Date User Action Args
2022-04-11 14:58:01adminsetgithub: 65448
2021-10-21 23:38:06iritkatrielsetnosy: + iritkatriel
messages: + msg404708
2020-03-18 18:29:22brett.cannonsetnosy: - brett.cannon
2014-04-16 18:47:11dokosetmessages: + msg216550
2014-04-15 22:16:21dokocreate