Warnings capture interferes with doctest #4732
Labels
plugin: doctests
related to the doctests builtin plugin
plugin: warnings
related to the warnings builtin plugin
type: bug
problem that needs to be addressed
The following approach to testing warnings works when using vanilla doctest, but fails under pytest:
What this does is redirect the warning output (which usually goes to stderr) to stdout, where it can and will be captured by doctest. Yes, it’s a hack, but I find it very surprising that it just suddenly ceases to work when run under pytest. (I understand the reason it does so, but I believe there should be a way around it.)
I’m willing to program a solution if I can think of one, but so far I can’t.
System info:
The text was updated successfully, but these errors were encountered: