[Pytest-commit] Issue #657: Errors in teardown_module erroneously attached to last executed test (hpk42/pytest)

David MacIver issues-reply at bitbucket.org
Wed Jan 14 09:33:15 CET 2015


New issue 657: Errors in teardown_module erroneously attached to last executed test
https://bitbucket.org/hpk42/pytest/issue/657/errors-in-teardown_module-erroneously

David MacIver:

Consider a test suite like the following:

```
#!python

def teardown_module(module):
    assert False


def test_stuff():
    pass


def test_things():
    pass

```

The result is:


```
collected 2 items 

test_module_teardown.py ..E

=================================================== ERRORS ===================================================
______________________________________ ERROR at teardown of test_things ______________________________________
Traceback (most recent call last):
  File "/home/david/projects/hypothesis/test_module_teardown.py", line 2, in teardown_module
    assert False
AssertionError: assert False


```

In particular the "ERROR at teardown of test_things" bit is weird. It's not a big deal, but it would be better if this didn't get attached to the test which just happens to have run last but was instead marked as belonging to the module.




More information about the pytest-commit mailing list