Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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()
orteardown()
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: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:
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