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: test_runpy failure
Type: behavior Stage:
Components: Tests Versions: Python 3.3
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: ncoghlan Nosy List: barry, ncoghlan, pitrou, vstinner
Priority: normal Keywords:

Created on 2011-05-19 16:25 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg136304 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-05-19 16:25
I get the following failures in a fresh checkout:

======================================================================
ERROR: test_explicit_relative_import (test.test_runpy.RunModuleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/antoine/t/cpython/Lib/test/test_runpy.py", line 283, in test_explicit_relative_import
    self._check_relative_imports(depth)
  File "/home/antoine/t/cpython/Lib/test/test_runpy.py", line 257, in _check_relative_imports
    make_legacy_pyc(mod_fname)
  File "/home/antoine/t/cpython/Lib/test/support.py", line 217, in make_legacy_pyc
    os.rename(pyc_file, legacy_pyc)
OSError: [Errno 2] No such file or directory

======================================================================
ERROR: test_main_relative_import (test.test_runpy.RunModuleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/antoine/t/cpython/Lib/test/test_runpy.py", line 288, in test_main_relative_import
    self._check_relative_imports(depth, "__main__")
  File "/home/antoine/t/cpython/Lib/test/test_runpy.py", line 257, in _check_relative_imports
    make_legacy_pyc(mod_fname)
  File "/home/antoine/t/cpython/Lib/test/support.py", line 217, in make_legacy_pyc
    os.rename(pyc_file, legacy_pyc)
OSError: [Errno 2] No such file or directory

======================================================================
ERROR: test_run_module (test.test_runpy.RunModuleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/antoine/t/cpython/Lib/test/test_runpy.py", line 273, in test_run_module
    self._check_module(depth)
  File "/home/antoine/t/cpython/Lib/test/test_runpy.py", line 177, in _check_module
    make_legacy_pyc(mod_fname)
  File "/home/antoine/t/cpython/Lib/test/support.py", line 217, in make_legacy_pyc
    os.rename(pyc_file, legacy_pyc)
OSError: [Errno 2] No such file or directory

======================================================================
ERROR: test_run_package (test.test_runpy.RunModuleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/antoine/t/cpython/Lib/test/test_runpy.py", line 278, in test_run_package
    self._check_package(depth)
  File "/home/antoine/t/cpython/Lib/test/test_runpy.py", line 201, in _check_package
    make_legacy_pyc(mod_fname)
  File "/home/antoine/t/cpython/Lib/test/support.py", line 217, in make_legacy_pyc
    os.rename(pyc_file, legacy_pyc)
OSError: [Errno 2] No such file or directory


Here is the test output:

test_run_code (test.test_runpy.RunModuleCodeTest) ... ok
test_run_module_code (test.test_runpy.RunModuleCodeTest) ... ok
test_explicit_relative_import (test.test_runpy.RunModuleTest) ... Testing relative imports at depth: 2
  Package tree in: /tmp/tmpmruwyg
  Updated sys.path: /tmp/tmpmruwyg
  Next level in: /tmp/tmpmruwyg/__runpy_pkg__
  Created: /tmp/tmpmruwyg/__runpy_pkg__/__init__.py
  Next level in: /tmp/tmpmruwyg/__runpy_pkg__/__runpy_pkg__
  Created: /tmp/tmpmruwyg/__runpy_pkg__/__runpy_pkg__/__init__.py
  Created: /tmp/tmpmruwyg/__runpy_pkg__/__runpy_pkg__/runpy_test.py
  Added sibling module: /tmp/tmpmruwyg/__runpy_pkg__/__runpy_pkg__/sibling.py
  Added uncle package: /tmp/tmpmruwyg/__runpy_pkg__/uncle
  Added cousin package: /tmp/tmpmruwyg/__runpy_pkg__/uncle/cousin
  Added nephew module: /tmp/tmpmruwyg/__runpy_pkg__/uncle/cousin/nephew.py
Running from source: __runpy_pkg__.__runpy_pkg__.runpy_test
  Removed sys.modules entries
  Removed sys.path entry
  Removed package tree
ERROR
test_invalid_names (test.test_runpy.RunModuleTest) ... ok
test_library_module (test.test_runpy.RunModuleTest) ... ok
test_main_relative_import (test.test_runpy.RunModuleTest) ... Testing main relative imports at depth: 2
  Package tree in: /tmp/tmp39sx5n
  Updated sys.path: /tmp/tmp39sx5n
  Next level in: /tmp/tmp39sx5n/__runpy_pkg__
  Created: /tmp/tmp39sx5n/__runpy_pkg__/__init__.py
  Next level in: /tmp/tmp39sx5n/__runpy_pkg__/__runpy_pkg__
  Created: /tmp/tmp39sx5n/__runpy_pkg__/__runpy_pkg__/__init__.py
  Created: /tmp/tmp39sx5n/__runpy_pkg__/__runpy_pkg__/runpy_test.py
  Added sibling module: /tmp/tmp39sx5n/__runpy_pkg__/__runpy_pkg__/sibling.py
  Added uncle package: /tmp/tmp39sx5n/__runpy_pkg__/uncle
  Added cousin package: /tmp/tmp39sx5n/__runpy_pkg__/uncle/cousin
  Added nephew module: /tmp/tmp39sx5n/__runpy_pkg__/uncle/cousin/nephew.py
Running from source: __runpy_pkg__.__runpy_pkg__.runpy_test
  Removed sys.modules entries
  Removed sys.path entry
  Removed package tree
ERROR
test_run_module (test.test_runpy.RunModuleTest) ... Testing package depth: 0
  Package tree in: /tmp/tmpy4y7in
  Updated sys.path: /tmp/tmpy4y7in
  Created: /tmp/tmpy4y7in/runpy_test.py
Running from source: runpy_test
  Removed sys.modules entries
  Removed sys.path entry
  Removed package tree
ERROR
test_run_package (test.test_runpy.RunModuleTest) ... Testing package depth: 1
  Package tree in: /tmp/tmp_7dx_4
  Updated sys.path: /tmp/tmp_7dx_4
  Next level in: /tmp/tmp_7dx_4/__runpy_pkg__
  Created: /tmp/tmp_7dx_4/__runpy_pkg__/__init__.py
  Created: /tmp/tmp_7dx_4/__runpy_pkg__/__main__.py
Running from source: __runpy_pkg__
  Removed sys.modules entries
  Removed sys.path entry
  Removed package tree
ERROR
test_basic_script (test.test_runpy.RunPathTest) ... ok
test_directory (test.test_runpy.RunPathTest) ... ok
test_directory_compiled (test.test_runpy.RunPathTest) ... ok
test_directory_error (test.test_runpy.RunPathTest) ... ok
test_main_recursion_error (test.test_runpy.RunPathTest) ... ok
test_script_compiled (test.test_runpy.RunPathTest) ... ok
test_zipfile (test.test_runpy.RunPathTest) ... ok
test_zipfile_compiled (test.test_runpy.RunPathTest) ... ok
test_zipfile_error (test.test_runpy.RunPathTest) ... ok
msg136316 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2011-05-19 17:10
It still works fine for me (as do test_imp, test_import and test_importlib).

Did you provide any arguments to ./configure, or provide any interesting options to regrtest to get it to fail?
msg136317 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2011-05-19 17:13
Oh, that's the other question - is there any chance you are passing -B or have PYTHONDONTWRITEBYTECODE set? (I'm not sure that would affect make_legacy_pyc, but all the errors you posted relate to unexpectedly absent pyc files and directories)
msg136318 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-05-19 17:29
Indeed, PYTHONDONTWRITEBYTECODE seems set by default on this Linux install... Ouch.
msg136346 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-05-20 00:12
Duplicate of #12117.
History
Date User Action Args
2022-04-11 14:57:17adminsetgithub: 56331
2011-05-20 00:12:32vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg136346

resolution: duplicate
2011-05-19 17:29:06pitrousetmessages: + msg136318
2011-05-19 17:13:15ncoghlansetmessages: + msg136317
2011-05-19 17:10:23ncoghlansetmessages: + msg136316
2011-05-19 16:25:01pitroucreate