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

Regression: doctests that used to pass are now failing #3410

Closed
Paulius-Maruska opened this issue Apr 19, 2018 · 4 comments
Closed

Regression: doctests that used to pass are now failing #3410

Paulius-Maruska opened this issue Apr 19, 2018 · 4 comments
Labels
plugin: doctests related to the doctests builtin plugin type: bug problem that needs to be addressed

Comments

@Paulius-Maruska
Copy link

Problem: Doctests that are trying to showcase logging features of the code no longer pass. When running under pytest. They still do pass, when using unittest or doctest runner, but fail when using pytest.

The minimal code to reproduce the bug can be found in this gist:
https://gist.github.com/Paulius-Maruska/055eede98347ee306939d43c35cfe459

@pytestbot
Copy link
Contributor

GitMate.io thinks possibly related issues are #758 (Doctests), #481 (Running doctests with -s fails?), #2955 (Fails or pass depending on capture mode!), #950 (Doctests fail when another test uses the fixture between runs.), and #1164 (test_something fails).

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Apr 19, 2018
@RonnyPfannschmidt
Copy link
Member

it seems like toxic doctests that just hook into the global logging setup where indeed a collateral to this
i believe its sufficient to disable the logging plugin of pytest to keep those tests running

my personal opinion is, its perfectly fine that doctests that modify random global state break on occasion, its simply really bad test design and had it coming

@RonnyPfannschmidt RonnyPfannschmidt added the plugin: doctests related to the doctests builtin plugin label Apr 19, 2018
@Paulius-Maruska
Copy link
Author

Well, I don't disagree with you, this is a rather bad case of doc string. But that doc string is written for documentation purposes. It is important to have that example in the docs. It is also important to somehow verify, that these examples in the docs are correct.

PS: current workaround - run your doctests separately using python -m doctest.

@nicoddemus
Copy link
Member

Thanks @Paulius-Maruska for sharing the workaround. I'm closing this for now, feel free to follow up with more questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: doctests related to the doctests builtin plugin type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

4 participants