fix issue177 - actually perform session scope finalization
This commit is contained in:
parent
5263656df6
commit
dfa273dc25
|
@ -1,2 +1,2 @@
|
|||
#
|
||||
__version__ = '2.2.2.dev6'
|
||||
__version__ = '2.2.2.dev7'
|
||||
|
|
|
@ -47,6 +47,8 @@ def pytest_terminal_summary(terminalreporter):
|
|||
|
||||
def pytest_sessionstart(session):
|
||||
session._setupstate = SetupState()
|
||||
def pytest_sessionfinish(session):
|
||||
session._setupstate.teardown_all()
|
||||
|
||||
class NodeInfo:
|
||||
def __init__(self, location):
|
||||
|
|
4
setup.py
4
setup.py
|
@ -17,14 +17,14 @@ Bugs and issues: http://bitbucket.org/hpk42/pytest/issues/
|
|||
|
||||
Web page: http://pytest.org
|
||||
|
||||
(c) Holger Krekel and others, 2004-2011
|
||||
(c) Holger Krekel and others, 2004-2012
|
||||
"""
|
||||
def main():
|
||||
setup(
|
||||
name='pytest',
|
||||
description='py.test: simple powerful testing with Python',
|
||||
long_description = long_description,
|
||||
version='2.2.2.dev6',
|
||||
version='2.2.2.dev7',
|
||||
url='http://pytest.org',
|
||||
license='MIT license',
|
||||
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
||||
|
|
|
@ -1551,3 +1551,21 @@ def test_unorderable_types(testdir):
|
|||
result = testdir.runpytest()
|
||||
assert "TypeError" not in result.stdout.str()
|
||||
assert result.ret == 0
|
||||
|
||||
def test_issue117_sessionscopeteardown(testdir):
|
||||
testdir.makepyfile("""
|
||||
def pytest_funcarg__app(request):
|
||||
app = request.cached_setup(
|
||||
scope='session',
|
||||
setup=lambda: 0,
|
||||
teardown=lambda x: 3/x)
|
||||
return app
|
||||
def test_func(app):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
assert result.ret != 0
|
||||
result.stderr.fnmatch_lines([
|
||||
"*3/x*",
|
||||
"*ZeroDivisionError*",
|
||||
])
|
||||
|
|
Loading…
Reference in New Issue