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_importlib uses a fixed name in /tmp
Type: behavior Stage: needs patch
Components: Library (Lib), Tests Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, pitrou
Priority: normal Keywords:

Created on 2009-11-01 22:41 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg94810 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-11-01 22:41
test_importlib uses fixed names in /tmp (e.g. /tmp/pkg), which will make
the tests fail is such files/dirs already exist and aren't writable by
the current user (which can happen if several users run the python test
suite...).
msg94812 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-11-01 23:10
Yeah, I should have used tempfile.mkdtemp().
msg94838 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-11-02 20:16
It sometimes seems to trigger another error:

======================================================================
ERROR: test_package (importlib.test.source.test_file_loader.SimpleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/var/lib/buildbot/cpython/trunk.pitrou-ubuntu/build/Lib/importlib/test/source/util.py",
line 78, in create_modules
    with open(file_path, 'w') as file:
IOError: [Errno 13] Permission denied: '/tmp/_pkg/__init__.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File
"/var/lib/buildbot/cpython/trunk.pitrou-ubuntu/build/Lib/importlib/test/source/test_file_loader.py",
line 33, in test_package
    with source_util.create_modules('_pkg.__init__') as mapping:
  File
"/var/lib/buildbot/cpython/trunk.pitrou-ubuntu/build/Lib/contextlib.py",
line 17, in __enter__
    return next(self.gen)
  File
"/var/lib/buildbot/cpython/trunk.pitrou-ubuntu/build/Lib/importlib/test/source/util.py",
line 88, in create_modules
    state_manager.__exit__(None, None, None)
UnboundLocalError: local variable 'state_manager' referenced before
assignment
msg94911 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-11-05 01:17
r76113 fixes the name problem in py3k. After I fix the other issue I will 
backport to 3.1.
msg94913 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-11-05 01:34
r76114 has the temp directory fix. r76115 has the backport to 3.1.
History
Date User Action Args
2022-04-11 14:56:54adminsetgithub: 51497
2009-11-05 01:34:46brett.cannonsetstatus: open -> closed
resolution: fixed
messages: + msg94913
2009-11-05 01:17:57brett.cannonsetmessages: + msg94911
2009-11-02 20:16:47pitrousetmessages: + msg94838
2009-11-01 23:10:51brett.cannonsetmessages: + msg94812
2009-11-01 22:41:19pitroucreate