Skip to content

Conversation

@gaogaotiantian
Copy link
Contributor

What changes were proposed in this pull request?

Allow test name patterns in run-tests.

Why are the changes needed?

Looking for the actual TestClass for a specific test is not trivial - because we are using Mixin pattern. The class where the test method is defined in is not the actual unittest class we run. This makes specifying a test case very difficult.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Manually comfirmed that pattern works.

Was this patch authored or co-authored using generative AI tooling?

No

try:
args = test_name.split()
if len(args) == 2:
args.insert(1, "-k")
Copy link
Contributor

Choose a reason for hiding this comment

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

why insert -k here?
I usually explicitly add -k if needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's more like a syntax sugar. Not many people are aware of the existence of -k - we also never mention it in our docs. It's not clear that we are passing the arguments to unittest.main.

The whole purpose of this is to make it easier for people to run an individual test, in an intuitive way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants