Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib2to3 and packaging tests fail because they write into protected directory #56540

Closed
vsajip opened this issue Jun 14, 2011 · 7 comments
Closed
Assignees
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@vsajip
Copy link
Member

vsajip commented Jun 14, 2011

BPO 12331
Nosy @vsajip, @benjaminp, @tarekziade, @merwok

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/merwok'
closed_at = <Date 2011-08-01.12:52:14.271>
created_at = <Date 2011-06-14.08:25:04.682>
labels = ['type-bug', 'tests']
title = 'lib2to3 and packaging tests fail because they write into protected directory'
updated_at = <Date 2011-08-01.12:52:14.269>
user = 'https://github.com/vsajip'

bugs.python.org fields:

activity = <Date 2011-08-01.12:52:14.269>
actor = 'eric.araujo'
assignee = 'eric.araujo'
closed = True
closed_date = <Date 2011-08-01.12:52:14.271>
closer = 'eric.araujo'
components = ['Tests', 'Distutils2']
creation = <Date 2011-06-14.08:25:04.682>
creator = 'vinay.sajip'
dependencies = []
files = []
hgrepos = []
issue_num = 12331
keywords = []
message_count = 7.0
messages = ['138302', '138309', '138321', '141020', '141497', '141498', '141501']
nosy_count = 7.0
nosy_names = ['vinay.sajip', 'benjamin.peterson', 'tarek', 'eric.araujo', 'alexis', 'python-dev', 'python272']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue12331'
versions = ['Python 2.7', 'Python 3.2', 'Python 3.3']

@vsajip
Copy link
Member Author

vsajip commented Jun 14, 2011

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'

@vsajip vsajip added topic-2to3 tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Jun 14, 2011
@vsajip
Copy link
Member Author

vsajip commented Jun 14, 2011

Some packaging tests also fail, for similar reasons:

======================================================================
ERROR: test_get_distinfo_file (packaging.tests.test_database.TestDistribution)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/local/lib/python3.3/packaging/tests/test_database.py", line 114, in setUp
    with open(record_file, 'w') as file:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python3.3/packaging/tests/fake_dists/babar-0.1.dist-info/RECORD'

@vsajip vsajip removed the topic-2to3 label Jun 14, 2011
@vsajip vsajip changed the title lib2to3 tests write into protected directory lib2to3 and packaging tests fail because they write into protected directory Jun 14, 2011
@merwok
Copy link
Member

merwok commented Jun 14, 2011

This should not be too hard to fix: I’ll move the directory with the mock projects to a temp dir, add that to sys.path, and then we’ll be able to read and write.

@merwok merwok assigned merwok and unassigned tarekziade Jun 14, 2011
@python272
Copy link
Mannequin

python272 mannequin commented Jul 23, 2011

problem exists in python 2.7.2 (should this be reported as a separate issue?)

[Python-2.7.2]$ python -m test.regrtest -v test_lib2to3
...
ERROR: test_bom (lib2to3.tests.test_refactor.TestRefactoringTool)
...
ERROR: test_crlf_newlines
ERROR: test_file_encoding
ERROR: test_refactor_file
...

e.g.,

File "/usr/local/lib/python2.7/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/python2.7/lib2to3/tests/data/fixers/parrot_example.py'
...
[test]# ls -l /usr/local/lib/python2.7/lib2to3/tests/data/fixers/parrot_example.py
-rw-r--r-- 1 root root 23 2011-07-23 11:48 /usr/local/lib/python2.7/lib2to3/tests/data/fixers/parrot_example.py

@python-dev
Copy link
Mannequin

python-dev mannequin commented Aug 1, 2011

New changeset 2b5a0c4e052b by Éric Araujo in branch '3.2':
Stop trying to write into the stdlib during lib2to3 tests (bpo-12331).
http://hg.python.org/cpython/rev/2b5a0c4e052b

New changeset 7ee8f413188e by Éric Araujo in branch 'default':
Stop trying to write into the stdlib during packaging tests (bpo-12331).
http://hg.python.org/cpython/rev/7ee8f413188e

@python-dev
Copy link
Mannequin

python-dev mannequin commented Aug 1, 2011

New changeset a425408f1e52 by Éric Araujo in branch '2.7':
Stop trying to write into the stdlib during lib2to3 tests (bpo-12331).
http://hg.python.org/cpython/rev/a425408f1e52

@merwok
Copy link
Member

merwok commented Aug 1, 2011

This is now fixed. Let me just eat these words: “This should not be too hard to fix”.

@merwok merwok closed this as completed Aug 1, 2011
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants