-
-
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
unittest: _top_level_dir is incorrectly persisted between calls to different load_test methods #59215
Comments
During the execution of the load tests protocol, the loader instance will set its _top_level_dir attribute, and this will persist if the loader is passed on to another load_tests method. If that method does not specify a top_level_dir in a discovery call, the wrong top_level_dir may be used, and loading will fail. You can reproduce this by having two test *packages* with a load_tests method that calls discover in their __init__.py, and specify both package names to the unittest CLI. |
Hello. I've attached a patch to cleanup self._top_level_dir in the end of discover(). Is that the expected behavior or I'm on the wrong track? |
My previous patch is incorrect, talking to voidspace on irc self._top_leve_dir should be reverted to it's previous value "so when discover is called the original value should be stored, then discovery done, and then the original restored" I'll work on this one. He also pointed out that this bugfix should be backported to 2.7 and 3.2 |
Updated patch to restore previous value of ._top_level_dir on discover() done. And added a unit test. |
This issue is not newcomer friendly, I remove the easy keyword. |
…ythonGH-15242) (cherry picked from commit fc5f68e) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
…ythonGH-15242) (cherry picked from commit fc5f68e) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
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:
Linked PRs
The text was updated successfully, but these errors were encountered: