-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Random failures when running test suite in parallel (-m test -j0) caused by test_regrtest #70483
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
Comments
test_regrtest creates temporary test files called test_regrtest_pid_xxx.py in Lib/test/. The problem is that some tests like test___all__ and test_zipfile haves test relying on the list of Lib/test/test_*.py. When tests are run in parallel, test_regrtest can creates temporary test_regrtest_pid_xxx.py files, test_zipfile sees them, test_regrtest removes them, and then test_zipfiles fails. The best would be to write these temporary files into a temporary directory, but I failed to fix Lib/test/regrtest.py to load tests from a different directory. In theory, Python 3 supports packages with files splitted into multiple directories, in practice it doesn't seem to work :-p Maybe test_regrtest should use a test submodule like Lib/test/temp_regrtest/ ? test_regrtest started to create temporary test_xxx.py files since issue bpo-25220. (Other changes to test_regrtest: issues bpo-18174, bpo-22806, bpo-25260, bpo-25306, bpo-25369, bpo-25373, bpo-25694). ====================================================================== Traceback (most recent call last):
File "/home/haypo/prog/python/default/Lib/test/test___all__.py", line 102, in test_all
with open(path, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/haypo/prog/python/default/Lib/test/test_regrtest_25743_noop20.py' |
The directory with test files can be read-only. test_regrtest should use temporary directory. |
test_regrtest skips tests which requires to write in Lib/test/ if the write fails. except PermissionError as exc:
if not sysconfig.is_python_build():
self.skipTest("cannot write %s: %s" % (path, exc))
Yes! That's the purpose of this issue! But I was unable to find a technical solution to implement this. I need to try harder :-) |
You say you couldn’t get the test package to be split into multiple directories. What did you try? As far as I can see, we need a way for test_regrtest to invoke the child process with some flag to say “add this extra directory to test.__path__”. |
Another idea is to make a loader script that loads the “test” module, patches its __path__, and then runs test.__main__ or whatever as usual. |
Hum, test_doctest, test_zipfile and test_pyclbr fail if test is converted to a package (if Lib/test/init.py is removed). Attached patch fixes test_zipfile. I created the issue bpo-26569 for test_pyclbr failure. |
I created the issue bpo-26641 for doctest (test_doctest). |
New changeset f7ddd72b70ea by Victor Stinner in branch 'default': New changeset c83349c129c9 by Victor Stinner in branch 'default': |
New changeset e29f12ed4444 by Victor Stinner in branch 'default': |
New changeset e47e00723e5d by Victor Stinner in branch 'default': |
Finally, I fixed the issue differently: test_regrtest now creates a temporary directory and uses --testdir command line parameter. Before, using --testdir didn't work because regrtest always added "test." prefix to module names (ex: test_os => test.test_os). It isn't the case anymore when --testdir is used. Buildbots are green, so I close the issue. |
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: