Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_name: Fix name conversion for UnitTest methods. #466

Closed

Conversation

ltfish
Copy link

@ltfish ltfish commented Apr 8, 2020

For UnitTest-wrapped functions, test_name() would convert a
module.class.test_function into "module.test_function" and lose the
class information. This is, unfortunately, not expected by the
MultiProcess plugin, which has a different way of converting tests to
their testids. This fix ensures for UnitTest-wrapped functions,
test_name() returns a "module.class.function"-style name that complies
with the manner that MultiProcess plugin expects.

This PR fixes issue #465.

For UnitTest-wrapped functions, test_name() would convert a
module.class.test_function into "module.test_function" and lose the
class information. This is, unfortunately, not expected by the
MultiProcess plugin, which has a different way of converting tests to
their testids. This fix ensures for UnitTest-wrapped functions,
test_name() returns a "module.class.function"-style name that complies
with the manner that MultiProcess plugin expects.

This PR fixes issue nose-devs#465.
@ltfish ltfish force-pushed the fix/util_test_name_transplanted_func branch from 7a81549 to 53f1746 Compare April 8, 2020 09:57
@ltfish ltfish force-pushed the fix/util_test_name_transplanted_func branch from 53f1746 to c6861db Compare April 8, 2020 10:03
@sirosen
Copy link
Collaborator

sirosen commented Apr 21, 2020

Thanks for the PR. I've been trying to get time to review it and test it on some testsuites I have, but it hasn't happened yet.

It seems right to me, but I want to at least turn #465 into a test-case to confirm that this works on all of our supported pythons before merging.

@sirosen sirosen self-assigned this Apr 21, 2020
method.__qualname__ does not play well with nose1 method wrappers (such
as nose.tools.raises, which leads to something like
`raises.<locals>.decorate.<locals>.newfunc`). Since this is a problem
with nose1, I decide to work around it here by only touching the
unittest-wrapped methods.
@sirosen
Copy link
Collaborator

sirosen commented Jan 22, 2021

With #472 merged, I believe this should now be closed as no longer necessary/desirable, since the bug has been fixed at a "deeper" level.

@ltfish, although I'm closing this, I want to say a big thanks for submitting this fix!

@sirosen sirosen closed this Jan 22, 2021
@ltfish ltfish deleted the fix/util_test_name_transplanted_func branch January 22, 2021 21:04
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.

2 participants