You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lib/test/test_compileall.py fails when run directly #70289
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/vstinner'closed_at=<Date2016-01-18.11:07:19.029>created_at=<Date2016-01-13.16:40:57.137>labels= ['tests']
title='Lib/test/test_compileall.py fails when run directly'updated_at=<Date2016-01-18.11:07:19.027>user='https://github.com/vstinner'
A cleaner way to do what you're after is to use test_importlib.util.import_state() where you can pass in an explicit value for sys.path to be temporarily set.
Otherwise I'm fine with the idea of the proposed change.
A cleaner way to do what you're after is to use test_importlib.util.import_state() where you can pass in an explicit value for sys.path to be temporarily set.
I would prefer to not couple test_importlib and test_compileall to keep tests independent. If you consider that it's worth, import_state() must be moved to test.support.
Activity
vstinner commentedon Jan 13, 2016
"./python Lib/test/test_compileall.py" fails on test_compile_path() because the Lib/test/ directory is in sys.path and this directory contains invalid Python scripts like Lib/test/badsyntax_pep3120.py
Attached patch fixes the issue by removing temporarely Lib/test/ from sys.path.
Note: Python 3.5 doesn't test compileall.compile_path() which fails. The new test was added by the changeset 71f071f2e074 of the issue bpo-25768.
brettcannon commentedon Jan 13, 2016
A cleaner way to do what you're after is to use test_importlib.util.import_state() where you can pass in an explicit value for sys.path to be temporarily set.
Otherwise I'm fine with the idea of the proposed change.
vstinner commentedon Jan 13, 2016
I would prefer to not couple test_importlib and test_compileall to keep tests independent. If you consider that it's worth, import_state() must be moved to test.support.
brettcannon commentedon Jan 13, 2016
Don't care enough to do the work to separate it out, so if you don't want to bother either then LGTM.
python-dev commentedon Jan 18, 2016
New changeset c6a0f424837a by Victor Stinner in branch 'default':
Fix test_compilepath() of test_compileall
https://hg.python.org/cpython/rev/c6a0f424837a