-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
gh-89392: Remove support of test_main() in libregrtest #108876
gh-89392: Remove support of test_main() in libregrtest #108876
Conversation
serhiy-storchaka
commented
Sep 4, 2023
•
edited by bedevere-bot
Loading
edited by bedevere-bot
- Issue: Always use unittest for collecting tests in regrtests #89392
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I would prefer a better error message if a test module has a test_main() function.
Lib/test/libregrtest/runtest.py
Outdated
else: | ||
def test_func(): | ||
return run_unittest(test_mod) | ||
assert not hasattr(test_mod, "test_main") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please replace the assert with a regular exception. Like:
if hasattr(test_mod, "test_main"):
raise Exception("Module {result.test_name} defines test_main() which is no longer supported by regrtest")
Maybe add a comment linking to https://github.com/python/cpython/issues/89392
.
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
There's a new commit after the PR has been approved. @vstinner: please review the changes made to this pull request. |
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
…ythonGH-108876). (cherry picked from commit 04a0830) Co-authored-by: Serhiy Storchaka <[email protected]>
GH-108897 is a backport of this pull request to the 3.12 branch. |
…ythonGH-108876). (cherry picked from commit 04a0830) Co-authored-by: Serhiy Storchaka <[email protected]>
GH-108898 is a backport of this pull request to the 3.11 branch. |
) (#108897) [3.12] gh-89392: Remove support of test_main() in libregrtest (GH-108876). (cherry picked from commit 04a0830) Co-authored-by: Alex Waygood <[email protected]>