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
test_compileall fails to build in the installed location #65463
Comments
the installation directory is non-writable, and the byte code files don't exist. [1/1] test_compileall
test test_compileall failed -- Traceback (most recent call last):
File "/usr/lib/python3.4/test/test_compileall.py", line 194, in test_no_args_respects_force_flag
self.assertRunOK('-f', PYTHONPATH=self.directory)
File "/usr/lib/python3.4/test/test_compileall.py", line 144, in assertRunOK
*self._get_run_args(args), **env_vars)
File "/usr/lib/python3.4/test/script_helper.py", line 69, in assert_python_ok
return _assert_python(True, *args, **env_vars)
File "/usr/lib/python3.4/test/script_helper.py", line 55, in _assert_python
"stderr follows:\n%s" % (rc, err.decode('ascii', 'ignore')))
AssertionError: Process return code is 1, stderr follows: 1 test failed: ====================================================================== Traceback (most recent call last):
File "/usr/lib/python3.4/test/test_compileall.py", line 194, in test_no_args_respects_force_flag
self.assertRunOK('-f', PYTHONPATH=self.directory)
File "/usr/lib/python3.4/test/test_compileall.py", line 144, in assertRunOK
*self._get_run_args(args), **env_vars)
File "/usr/lib/python3.4/test/script_helper.py", line 69, in assert_python_ok
return _assert_python(True, *args, **env_vars)
File "/usr/lib/python3.4/test/script_helper.py", line 55, in _assert_python
"stderr follows:\n%s" % (rc, err.decode('ascii', 'ignore')))
AssertionError: Process return code is 1, stderr follows: |
what happens here: PYTHONPATH=$(pwd) python3.4 -X faulthandler -S -m compileall so even when overwriting PYTHONPATH, the standard locations are searched and tried to compile, which fails when these are read only. Is this behaviour expected? The tests itself can be fixed by passing the the test directory as an argument, as done in other tests too. |
adding unittest developers |
Verified failure on installed 3.4.3, Win 7, with 3 rather than 1 error (all similar). First traceback ends with followed by another ending with Why is an astral char in the error message? Will try patch. |
David, I am nosying you because this issue proposes to modify two test functions you added to test_compileall. See my prior message.For me, the test failed at every first occurrence of 'PYTHONPATH=' in the 3 functions. With one occurrence removed, the next in the same function failed. With all 6 removed, I get 1 error: FAIL: test_no_args_compiles_path (test.test_compileall.CommandLineTests) Traceback (most recent call last):
File "C:\Programs\Python34\lib\test\test_compileall.py", line 179, in test_no_args_compiles_path
self.assertNotCompiled(self.initfn)
File "C:\Programs\Python34\lib\test\test_compileall.py", line 159, in assertNotCompiled
self.assertFalse(os.path.exists(path))
AssertionError: True is not false The tests all pass in current uninstalled 3.4.3+ repository. If I remove all 6, I get the error above. Changing how the directory is passed apparently changes what get compiled. From the title of the test ad the comment "# Note that -l is implied for the no args case.", this is expected and is the point of the test. So deleting 'PYTHONPATH=' must be wrong. I believe we should detect that modifying the environment will not work before calling assertRunOK and skip the latter if it cannot work. The other two functions were added in bpo-19532 by RDM. I think we need to know why they were written as they are before changing them. Perhaps they pass with 'PYTHONPATH=' removed because they are incomplete. |
Yes the point is to test compilation of the path. If I run python3 -m compilelall on my installed python, it works fine (zero return code). I can't really investigate this further right now, but it isn't obvious to me what the answer is from the information in the issue so far, except that it doesn't *look* like it should be necessary to skip the tests unless the installation directories are read only *and* the .pyc files in them are non-existent or out of date. |
Issue bpo-25099 seems to also be related to a similar issue. A proposed fix can be found over there. |
I consider this fixed by way of issue bpo-25099. If that's wrong then feel free to open the issue again. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: