[Python-Dev] unittest isolation and warnings
Christian Tismer
tismer at stackless.com
Fri Nov 17 04:15:24 EST 2017
Hi guys,
when writing tests, I suddenly discovered that unittest
is not isolated to warnings.
Example:
One of my tests emits warnings when a certain condition is
met. Instead of reporting the error immediately, it uses
warnings, and at the end of the test, an error is produced
if there were warnings.
if hasattr(__main__, "__warningregistry__"):
raise RuntimeError("There are errors, see above.")
By chance, I discovered that an error was suddenly triggered without
a warning. That must mean the warning existed already from
another test as a left-over.
My question:
Is that known, and is that intended?
To what extent are the test cases isolated from each other?
I do admit that my usage of warnings is somewhat special.
But it is very convenient to report many errors on remote servers.
Cheers -- Chris
--
Christian Tismer :^) tismer at stackless.com
Software Consulting : http://www.stackless.com/
Karl-Liebknecht-Str. 121 : https://github.com/PySide
14482 Potsdam : GPG key -> 0xFB7BEE0E
phone +49 173 24 18 776 fax +49 (30) 700143-0023
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171117/a186e093/attachment.sig>
More information about the Python-Dev
mailing list