Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-108828: Support selecting tests by labels#108829

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
serhiy-storchaka wants to merge7 commits intopython:main
base:main
Choose a base branch
Loading
fromserhiy-storchaka:libregrtest-labels

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commentedSep 2, 2023
edited by bedevere-bot
Loading

@serhiy-storchakaserhiy-storchaka added type-featureA feature request or enhancement testsTests in the Lib/test dir needs backport to 3.11only security fixes needs backport to 3.12only security fixes labelsSep 2, 2023
@serhiy-storchakaserhiy-storchaka marked this pull request as ready for reviewSeptember 3, 2023 09:56
@vstinner
Copy link
Member

If possible, I would prefer to land my PR#108858 before.

@brettcannonbrettcannon removed their request for reviewSeptember 5, 2023 22:05
Copy link
Member

@sobolevnsobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks a lot for working on this, it is definetely a step in the right direction for our test suite.

I have a question about naming, though.
Some tests inLib/test/test_regrtest.py would also be nice, or I can add them later :)

I already have several ideas on top of this PR!

@@ -498,16 +500,34 @@ The :mod:`test.support` module defines the following functions:
rather than looking directly in the path directories.


.. function:: mark(label, *, globals=None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would prefer to always call them "marks". The main reason is thatpytest uses the same idea and pytest's marks are well-known.

Suggested change
..function::mark(label, *, globals=None)
..function::mark(name, *, globals=None)

Right nowmark function adds a "label". It does not sound right.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Or we can always call it "label".

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yes, it is similar to pytest's markers, but there are enough differences in applying them and filtering by them. I do not have preference, "label", "marker" and "tag" are all look like synonyms in this context to me.

@@ -498,16 +500,34 @@ The :mod:`test.support` module defines the following functions:
rather than looking directly in the path directories.


.. function:: mark(label, *, globals=None)

Add a label to tests.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
Add alabel to tests.
Add amark to tests.

@@ -78,6 +78,14 @@ def __init__(self, ns: Namespace):
self.ignore_tests: FilterTuple = tuple(ns.ignore_tests)
else:
self.ignore_tests = None
if ns.accept_labels:
self.accept_labels: tuple[str, ...] = tuple(ns.accept_labels)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Maybeset[str]?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

For some reasons they should be immutable, as well asmatch_tests andignore_tests.

In any case, I am planning to rewrite filtering by names. Instead of two tuples there will be more complex structure where order matters. And the same can be used for labels.

@@ -1002,16 +1015,41 @@ def wrapper(self):
#=======================================================================
# unittest integration.

def _id(obj):
return obj
def mark(label, *, globals=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I had a similar API in one of my OS libs, users didn't like it at all :(

I think it would be better to usemark(..., *, module=False)

This way we can:

  1. Simplify the API for readers (even if our users are people working on CPython)
  2. Useframe hack to get the neededglobals()

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I do not like to depend on such hack it tests. If it does not work, many unrelated tests will not even be able to load.

Since it is an internal API used in limited number of places, simplicity for users is less important.support.mark('gui', globals=globals()) is not much worse thansupport.mark('gui', module=True)

@serhiy-storchakaserhiy-storchaka added needs backport to 3.13bugs and security fixes and removed needs backport to 3.11only security fixes labelsMay 9, 2024
@Yhg1sYhg1s removed the needs backport to 3.12only security fixes labelApr 8, 2025
@serhiy-storchakaserhiy-storchaka added the needs backport to 3.14bugs and security fixes labelMay 8, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sobolevnsobolevnsobolevn left review comments

@vstinnervstinnerAwaiting requested review from vstinner

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

@ncoghlanncoghlanAwaiting requested review from ncoghlanncoghlan is a code owner

@warsawwarsawAwaiting requested review from warsawwarsaw is a code owner

Assignees
No one assigned
Labels
awaiting core reviewneeds backport to 3.13bugs and security fixesneeds backport to 3.14bugs and security fixestestsTests in the Lib/test dirtype-featureA feature request or enhancement
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@serhiy-storchaka@vstinner@sobolevn@Yhg1s@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp