<div dir="ltr">Hi,<br><br>I've got some tests for a module which manages log files.
The setup_class and teardown_class functions create and delete a
directory for them, and the teardown_method function deletes the
individual files based on a list. When a test fails, it can leave files
which aren't on the list, so don't get deleted in teardown_method,
which makes teardown_class choke on os.rmdir (because the directory is
not empty). While I do need to know if there are files left over, the
problem is that when an exception occurs in a hook, it shows a
traceback for that only, and not the actual test failure, so I can't
tell what failed.<br>
<br>Am I just doing this wrong, or is this a bit of a bug? I would
prefer an exception in [setup|teardown]_method to fail that method, and
an exception in [setup|teardown]_class to fail all the tests in that
class, and if an exception is raised in a test and the following hook,
tracebacks for both should be displayed.<br>
<br>As an aside, stdout capture doesn't work particularly well from the hooks either.<br><br>Matthew</div>