[New-bugs-announce] [issue12331] lib2to3 tests write into protected directory

Vinay Sajip report at bugs.python.org
Tue Jun 14 10:25:05 CEST 2011

New submission from Vinay Sajip <vinay_sajip at yahoo.co.uk>:

Some of the tests for lib2to3 write into folders which are protected in an installed Python. This means that regression tests fail when run on an installed Python, even though they run wihtout these errors on a source build. I think writes should be done into temp files, so that you can run regressions on installed Pythons.

Example failure:

ERROR: test_refactor_file (lib2to3.tests.test_refactor.TestRefactoringTool)
Traceback (most recent call last):
  File "/usr/local/lib/python3.3/lib2to3/tests/test_refactor.py", line 190, in check_file_refactoring
    rt.refactor_file(test_file, True)
  File "/usr/local/lib/python3.3/lib2to3/refactor.py", line 353, in refactor_file
    write=write, encoding=encoding)
  File "/usr/local/lib/python3.3/lib2to3/refactor.py", line 518, in processed_file
    self.write_file(new_text, filename, old_text, encoding)
  File "/usr/local/lib/python3.3/lib2to3/refactor.py", line 530, in write_file
    f = _open_with_encoding(filename, "w", encoding=encoding)
IOError: [Errno 13] Permission denied: '/usr/local/lib/python3.3/lib2to3/tests/data/fixers/parrot_example.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.3/lib2to3/tests/test_refactor.py", line 200, in test_refactor_file
    self.check_file_refactoring(test_file, _DEFAULT_FIXERS)
  File "/usr/local/lib/python3.3/lib2to3/tests/test_refactor.py", line 194, in check_file_refactoring
    with open(test_file, "wb") as fp:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python3.3/lib2to3/tests/data/fixers/parrot_example.py'

components: 2to3 (2.x to 3.0 conversion tool), Tests
messages: 138302
nosy: benjamin.peterson, vinay.sajip
priority: normal
severity: normal
status: open
title: lib2to3 tests write into protected directory
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list