[issue15551] Unit tests that return generators silently fail

R. David Murray report at bugs.python.org
Sat Aug 4 23:54:39 CEST 2012


R. David Murray added the comment:

This is not something that is specific to unittest.  In Python, if you call a generator function *it returns a generator-iterator*.  Unless you *do* something with the the iterator, nothing else happens.  This is true in *any* python code.  

Unittest calls whatever test method you define, and handles (reports) the exceptions that result from that call.  That's the fundamental design of unittest.  Your generator test method does not raise any exceptions when called, therefore the test passed.

----------
nosy: +r.david.murray

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15551>
_______________________________________


More information about the Python-bugs-list mailing list