KEMBAR78
gh-89392: Remove support of test_main() in libregrtest by serhiy-storchaka · Pull Request #108876 · python/cpython · GitHub
Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Sep 4, 2023

Copy link
Member

@vstinner vstinner left a 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.

else:
def test_func():
return run_unittest(test_mod)
assert not hasattr(test_mod, "test_main")
Copy link
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:

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.

@serhiy-storchaka serhiy-storchaka merged commit 04a0830 into python:main Sep 5, 2023
@miss-islington
Copy link
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

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
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
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

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

@bedevere-bot bedevere-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

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

@bedevere-bot bedevere-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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants