diff --git a/CHANGELOG b/CHANGELOG index c77c95d41..82b6d7f48 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,8 @@ Changes between 1.0.0b3 and 1.0.0 * remove scope-argument from request.addfinalizer() because request.cached_setup has the scope arg. TOOWTDI. +* perform setup finalization before reporting failures + Changes between 1.0.0b1 and 1.0.0b3 ============================================= diff --git a/py/test/plugin/pytest_runner.py b/py/test/plugin/pytest_runner.py index 62404084a..151881567 100644 --- a/py/test/plugin/pytest_runner.py +++ b/py/test/plugin/pytest_runner.py @@ -19,11 +19,14 @@ def pytest_addoption(parser): action="store_true", dest="boxed", default=False, help="box each test run in a separate process") +# XXX move to pytest_sessionstart and fix py.test owns tests def pytest_configure(config): config._setupstate = SetupState() -def pytest_unconfigure(config): - config._setupstate.teardown_all() +def pytest_sessionfinish(session, exitstatus, excrepr=None): + # XXX see above + if hasattr(session.config, '_setupstate'): + session.config._setupstate.teardown_all() def pytest_make_collect_report(collector): call = collector.config.guardedcall( diff --git a/py/test/plugin/pytest_terminal.py b/py/test/plugin/pytest_terminal.py index 1098b3095..491c500a3 100644 --- a/py/test/plugin/pytest_terminal.py +++ b/py/test/plugin/pytest_terminal.py @@ -227,7 +227,8 @@ class TerminalReporter: for i, testarg in py.builtin.enumerate(self.config.args): self.write_line("test object %d: %s" %(i+1, testarg)) - def pytest_sessionfinish(self, session, exitstatus, excrepr=None): + def pytest_sessionfinish(self, __call__, session, exitstatus, excrepr=None): + __call__.execute() self._tw.line("") if exitstatus in (0, 1, 2): self.summary_failures()