-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Multiple tests failing when invoked directly via ./python Lib/test/...
#131290
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
Hello i would like to take for this |
@MaximGit1 Thank you, please go ahead and ask any questions you have :) |
Hello, I am currently running "Lib/test/test_metaclass.py". Running it directly (./python Lib/test/test_metaclass.py) works in the global namespace (main), so module becomes 'main'. This creates a conflict since the module should be called "test.test_metaclass". To fix this, I decided to do this. if __name__ == "__main__":
__name__ = "test.test_metaclass" # predefined name
unittest.main() I think this is the best solution because I don't change the logic of the tests. How good do you think this solution is? |
@sobolevn I finished |
For regrtest, I would prefer this fix: diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 510c8f69631..7e317d5ab94 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -2546,4 +2546,5 @@ def test_test_result_get_state(self):
if __name__ == '__main__':
+ setup.setup_process()
unittest.main() |
…ts (#131371) --------- Co-authored-by: Bénédikt Tran <[email protected]>
Thank you @MaximGit1 for fixing this! |
Besides
test_pickle
reported in #131031, there are a few more (test_regrtest
,test_metaclass
andtest_pyclbr
):Linked PRs
The text was updated successfully, but these errors were encountered: