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

Resolving Issue #10825 #11683

Closed
wants to merge 1 commit into from
Closed

Resolving Issue #10825 #11683

wants to merge 1 commit into from

Conversation

ardavan34
Copy link

Hello,

This PR resolves #10825 issue. It is related to the new versions of PyTest and not reproducible on the main branch.

Description

If the user adds doctest to a test file, if there is a function in the code setup() or teardown() that is not used for test, they would be automatically called. This would basically cause a very long error message which is not even related to the actual test:
Screenshot from 2023-12-07 00-17-52

Solution

To avoid this long error message, I have added code for this edge case to basically ignore the error caused by it. A warning message is also added to inform the user about using a function name (setup or teardown) that might cause problem. Here is the new outcome for the same test:
Screenshot from 2023-12-07 00-12-38
This would make the API report only the actual test which is the other function, have a much cleaner output and inform the user about possible bugs that having a function in the specific name might have.

I hope it would come in handy.

Thanks,
Ardavan

@bluetech
Copy link
Member

Thanks @ardavan34. Please see the comment I've just left on the issue #10825 (comment); unfortunately we can't accept a patch like you propose for backward compatibility reasons (also, the problem is that setup is executed at all, not just/if it raises an error). So we'll have to wait until the deprecation expires for the issue to be resolved.

@bluetech bluetech closed this Dec 14, 2023
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