-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Is there a way to run doctests and continue on failure? #3149
Comments
Hi @will133 thanks for reporting this. It seems like this is a bug in pytest and I don't know of any workaround, I'm afraid. 😕 |
I ran a debugger in the two cases and it seems like in _pytest/doctest.py it would uses doctest.DebugRunner instead of the testmod() case which uses the doctest.DocTestRunner. The DebugRunner would raise an exception when it calls the self.report_failure(). In such case it would not continue to run the rest of the examples. The DocTestRunner would output the Expected/Got failure but would not raise an exception. I'm not so familiar with the _pytest/doctest.py module, but do you know why it would use a DebugRunner there? |
I'm not sure, indeed one of the differences between those is that |
It seems like the I'm not sure how to make it work properly. Should the |
@will133 sorry for the delay. Your proposal of using a custom subclass of Would you like to give this a try? |
I have not checked in things for the pytest repo before, so please let me know what I'd need to change for the pull request. |
Say you have a file named t.py:
When I run this, I would get:
However, when I run with pytest, I would only get the first failure:
I've tried to dig through all the options form the documentation but I wan't able to figure it out. Is there a way to have pytest report all the failures at once? Otherwise I'd have to fix the failures one by one, which gets tedious. I tried to put in various entries in --doctest-report='none' but can't get it to work.
Here is the relevant section in setup.cfg:
Here is my pip list:
The text was updated successfully, but these errors were encountered: