Skip to content

gh-89392: Remove support of test_main() in libregrtest - #108876

Merged
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:regretest-no-test_main
Sep 5, 2023
Merged

gh-89392: Remove support of test_main() in libregrtest#108876
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:regretest-no-test_main

Conversation

@serhiy-storchaka

@serhiy-storchakaserhiy-storchaka commented Sep 4, 2023

Copy link
Copy Markdown
Member

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

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.

Comment threadLib/test/libregrtest/runtest.py Outdated
else:
def test_func():
return run_unittest(test_mod)
assert not hasattr(test_mod, "test_main")

Copy link
Copy Markdown
Member

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:

ifhasattr(test_mod, "test_main"):
raiseException("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.

Comment threadLib/test/libregrtest/runtest.py Outdated
@serhiy-storchaka
serhiy-storchaka merged commit 04a0830 into python:mainSep 5, 2023
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@serhiy-storchaka
serhiy-storchaka deleted the regretest-no-test_main branch September 5, 2023 05:36
@bedevere-bot

Copy link
Copy Markdown

There's a new commit after the PR has been approved.

@vstinner: please review the changes made to this pull request.

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 04a0830b00879efe057e3dfe75e9aa9c0caf1a26 3.12

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 04a0830b00879efe057e3dfe75e9aa9c0caf1a26 3.11

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Sep 5, 2023
…ythonGH-108876).
(cherry picked from commit 04a0830)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

GH-108897 is a backport of this pull request to the 3.12 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.12 only security fixes label Sep 5, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Sep 5, 2023
…ythonGH-108876).
(cherry picked from commit 04a0830)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

GH-108898 is a backport of this pull request to the 3.11 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.11 only security fixes label Sep 5, 2023
serhiy-storchaka added a commit that referenced this pull request Sep 5, 2023
Yhg1s pushed a commit that referenced this pull request Sep 5, 2023
) (#108897)
[3.12] gh-89392: Remove support of test_main() in libregrtest (GH-108876).
(cherry picked from commit 04a0830)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@serhiy-storchakaserhiy-storchaka removed their assignment Sep 8, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core reviewtestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@serhiy-storchaka@miss-islington@bedevere-bot@vstinner