-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Multiple test modules fail to run if invoked directly #90583
Comments
While working on a similar issue for So, after several hours of local testing, I got several problems:
Probably there are other problems, because I haven't checked:
To keep PRs reviews sane, I will include changes for several modules and split this big task of checking all test modules into several consecutive and rather simple pull requests. The first one with the problems described above is on its way! |
I suggest your grouping of PRs be by error type -- so have batches of "relative import" fixes and batches of "TESTFN" fixes, etc. |
Thank you, Ethan. Good idea! Will do from the second PR. |
Nikita, thanks for doing this. Ethan's suggestion has two advantages. 1. It would fix most backport issues. By containing a mix of changes, PR-30666 cannot be backported as is. 'unittest.main' should always backport unless there is a context conflict. But 3.9 does not have os.helper and TESTFN is still in test.support in 3.9 and that change cannot backport. (I did not check 3.10.)
I suggest you write a script to directly run each test.test_xyz file via subprocess and report to stdout. The test for this issue is a clean report. If you do so, I will run it on Windows in a fresh build of each of 3.9, 3.10, and 3.11. Note that there are two possible commands: 'python -m test test_xyz' and 'python -m test.test_xyz'. They are subtly different. So I would add an option to do it each way. With current 3.11, test_importlib runs fine on my Windows, with 1436 tests. |
Terry, yes I am using this script to run tests locally: #!/usr/bin/env bash
set -e
while read line; do
./python.exe "$line"
done < files.txt And this one to populate find ./Lib -iname 'test*.py' -o -iname '*tests.py' -exec echo {} >> files.txt \; --- There are several other problems that I have to fix manually. For example, module-level
I am not sure what is the proper solution to this one 🤔 Probably, I will update my script for more advanced Python-based one and ignore this exception. In the end, I expect to run this script without any failures. This is going to be a great result! --- I will also check that all possible modes --- Also, thank you for listing concrete problems with my first submission. The second one is bound to a single problem and a single submodule. |
Important note, in practice there's also a difference in how one calls some test module:
Example of a test failure because of that: #30681 |
@sobolevn Is this fixed now or are there more modules left? |
test_sqlite3
#30676test_contextlib
#30681test_importlib
#30682asyncio
tests #30725test_traceback
#30746asyncio
tests (GH-30725) #30782asyncio
tests (GH-30725) #30783test_fileutils
andtest_zoneinfo
#30792importlib.metadata
andimportlib.resources
tests #30800Note: 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: