Skip to content

bpo-32071: Add unittest -k option#4496

Merged
pitrou merged 4 commits intopython:masterfrom
jonashaag:unittest-select2
Nov 25, 2017
Merged

bpo-32071: Add unittest -k option#4496
pitrou merged 4 commits intopython:masterfrom
jonashaag:unittest-select2

Conversation

@jonashaag
Copy link
Copy Markdown
Contributor

@jonashaag jonashaag commented Nov 21, 2017

@the-knights-who-say-ni
Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

Copy link
Copy Markdown
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thank you for posting this PR. In addition to the review comments I posted, there are two points to address:

  • sign the contributor's agreement, if you haven't already done so
  • add documentation for the new command-line option and the TestLoader addition; the docs are Doc/library/unittest.rst

Comment thread Lib/unittest/main.py Outdated
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.

I'm curious, why was this change necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This refactoring was necessary because I didn't want to repeat the code that sets loader.testNamePatterns from the CLI options. That code has to be executed BEFORE loader.discover. Besides, I believe it makes sense to have a single place where self.test is set.

Comment thread Lib/unittest/test/test_program.py Outdated
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.

Thank you for adding these tests. Do you think you could also create a small functional test? There is an example of such a test (using subprocess) in Test_TextTestRunner.test_warnings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added a functional test but I'm not sure if that's the right place to put it.

@bedevere-bot
Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@warsaw
Copy link
Copy Markdown
Member

warsaw commented Nov 22, 2017

There really should be both an issue opened and a NEWS item for this. These should not be skipped. Otherwise, I have to read the diff to infer what -k is supposed to do.

@pitrou pitrou changed the title Add unittest -k option bpo-32071: Add unittest -k option Nov 22, 2017
@pitrou
Copy link
Copy Markdown
Member

pitrou commented Nov 22, 2017

I fixed the title to refer to the issue on the bug tracker.
As for the NEWS entry, you're right, I forgot this. @jonashaag, you can add one using the blurb utility.

@jonashaag
Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot
Copy link
Copy Markdown

Thanks for making the requested changes!

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

@jonashaag
Copy link
Copy Markdown
Contributor Author

I'm not sure what the Sphinx error means.

Comment thread Doc/library/unittest.rst Outdated
List of Unix shell-style wildcard test name patterns that test methods
have to match to be included in test suites (see ``-v`` option).

If this attribute is not `None` (the default), all test methods to be
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.

The sphinx build says:
[2] library/unittest.rst:1772: default role used
It points to line 1772 of unittest.rst.
I think it's because single backticks was used around None.
Try using double backticks instead.

Comment thread Doc/library/unittest.rst Outdated
The command-line option ``--locals``.

.. versionadded:: 3.7
The command-line option ``-k``.
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.

Add one more space before "The command-line .. ".

Comment thread Doc/library/unittest.rst Outdated
imported by the test loader.

For example, ``-k foo`` matches ``foo_tests.SomeTest.test_something``,
``bar_tests.SomeTest.test_foo``, but not `bar_tests.FooTest.test_something``.
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.

Mismatched number of backticks in bar_tests.FooTest.test_something.

@jonashaag
Copy link
Copy Markdown
Contributor Author

Not sure why CLA not signed label is still there; I signed it on 2017-11-21.

@pitrou
Copy link
Copy Markdown
Member

pitrou commented Nov 24, 2017

Not sure why CLA not signed label is still there; I signed it on 2017-11-21.

Hmm... I've tried to reach to some people who might have a clue about that :-)

@vstinner
Copy link
Copy Markdown
Member

@vstinner vstinner removed the CLA not signed label just now

and

@the-knights-who-say-ni ay-ni the-knights-who-say-ni added the CLA not signed label just now

@jonashaag: If the bot adds again "not signed", it means that you forgot to fill your GitHub account login in your bugs.python.org profile.

@vstinner
Copy link
Copy Markdown
Member

Read also the @the-knights-who-say-ni message which explains that ;-) #4496 (comment)

@jonashaag
Copy link
Copy Markdown
Contributor Author

@vstinner It's there, I added it on 2017-11-21.

@jonashaag
Copy link
Copy Markdown
Contributor Author

Screenshots of signed CLA as received from Adobe sign (?)

Is there a manual check by a human involved in the process? If so, maybe the person simply hasn't found the time to process it.

bildschirmfoto 2017-11-24 um 14 35 59

bildschirmfoto 2017-11-24 um 14 36 09

@vstinner
Copy link
Copy Markdown
Member

On bugs.python.org, I still see "Contributor Form Received: No".

Yeah, I think that a human process is required somewhere.

@ejodlowska
Copy link
Copy Markdown

@vstinner bugs account has been updated. For whatever reason, the email notification never came through.

@vstinner
Copy link
Copy Markdown
Member

Ok, the CLA signed label is now here :-) Thank you Ewa.

@pitrou
Copy link
Copy Markdown
Member

pitrou commented Nov 25, 2017

The PR now looks good to me, I'm going to merge.

@pitrou pitrou merged commit 5b48dc6 into python:master Nov 25, 2017
slawqo added a commit to slawqo/ryu that referenced this pull request Jul 25, 2018
Due to change [1] in python 3.7 one of ryu's unit tests
was failing with this version of interpreter. It was like that
because of missing __qualname__ attribute in functools.partial
object.
This patch fixes it by adding such attribute if it's not
set already.

[1] python/cpython#4496
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants