yay! now that we have perfect teardowns we don't need some ugly internal hooks anymore.

This commit is contained in:
holger krekel 2011-12-02 21:00:21 +00:00
parent c4fe622b82
commit 8307270cec
6 changed files with 3 additions and 21 deletions

View File

@ -1,2 +1,2 @@
# #
__version__ = '2.2.1.dev1' __version__ = '2.2.1.dev2'

View File

@ -165,14 +165,6 @@ def pytest_runtest_logreport(report):
""" process a test setup/call/teardown report relating to """ process a test setup/call/teardown report relating to
the respective phase of executing a test. """ the respective phase of executing a test. """
# special handling for final teardown - somewhat internal for now
def pytest__teardown_final(session):
""" called before test session finishes. """
pytest__teardown_final.firstresult = True
def pytest__teardown_final_logerror(report, session):
""" called if runtest_teardown_final failed. """
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# test session related hooks # test session related hooks
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------

View File

@ -48,13 +48,6 @@ def pytest_terminal_summary(terminalreporter):
def pytest_sessionstart(session): def pytest_sessionstart(session):
session._setupstate = SetupState() session._setupstate = SetupState()
def pytest_sessionfinish(session, exitstatus):
hook = session.config.hook
rep = hook.pytest__teardown_final(session=session)
if rep:
hook.pytest__teardown_final_logerror(session=session, report=rep)
session.exitstatus = 1
class NodeInfo: class NodeInfo:
def __init__(self, location): def __init__(self, location):
self.location = location self.location = location

View File

@ -161,9 +161,6 @@ class TerminalReporter:
def pytest_deselected(self, items): def pytest_deselected(self, items):
self.stats.setdefault('deselected', []).extend(items) self.stats.setdefault('deselected', []).extend(items)
def pytest__teardown_final_logerror(self, report):
self.stats.setdefault("error", []).append(report)
def pytest_runtest_logstart(self, nodeid, location): def pytest_runtest_logstart(self, nodeid, location):
# ensure that the path is printed before the # ensure that the path is printed before the
# 1st test of a module starts running # 1st test of a module starts running

View File

@ -24,7 +24,7 @@ def main():
name='pytest', name='pytest',
description='py.test: simple powerful testing with Python', description='py.test: simple powerful testing with Python',
long_description = long_description, long_description = long_description,
version='2.2.1.dev1', version='2.2.1.dev2',
url='http://pytest.org', url='http://pytest.org',
license='MIT license', license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

View File

@ -205,7 +205,7 @@ class TestPerTestCapturing:
#"*1 fixture failure*" #"*1 fixture failure*"
]) ])
def test_teardown_final_capturing(self, testdir): def test_teardown_capturing_final(self, testdir):
p = testdir.makepyfile(""" p = testdir.makepyfile("""
def teardown_module(mod): def teardown_module(mod):
print ("teardown module") print ("teardown module")