[py-svn] commit/pytest: hpk42: fix issue177 - actually perform session scope finalization
Bitbucket
commits-noreply at bitbucket.org
Wed Feb 1 15:05:43 CET 2012
1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/changeset/d91418fd9fda/
changeset: d91418fd9fda
user: hpk42
date: 2012-02-01 14:52:34
summary: fix issue177 - actually perform session scope finalization
affected #: 4 files
diff -r 6ef58a23837631d521e24ba7100a8cc40cb67c5e -r d91418fd9fda307e93246c053cbc725ad43b6394 _pytest/__init__.py
--- a/_pytest/__init__.py
+++ b/_pytest/__init__.py
@@ -1,2 +1,2 @@
#
-__version__ = '2.2.2.dev6'
+__version__ = '2.2.2.dev7'
diff -r 6ef58a23837631d521e24ba7100a8cc40cb67c5e -r d91418fd9fda307e93246c053cbc725ad43b6394 _pytest/runner.py
--- a/_pytest/runner.py
+++ b/_pytest/runner.py
@@ -47,6 +47,8 @@
def pytest_sessionstart(session):
session._setupstate = SetupState()
+def pytest_sessionfinish(session):
+ session._setupstate.teardown_all()
class NodeInfo:
def __init__(self, location):
diff -r 6ef58a23837631d521e24ba7100a8cc40cb67c5e -r d91418fd9fda307e93246c053cbc725ad43b6394 setup.py
--- a/setup.py
+++ b/setup.py
@@ -17,14 +17,14 @@
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'],
diff -r 6ef58a23837631d521e24ba7100a8cc40cb67c5e -r d91418fd9fda307e93246c053cbc725ad43b6394 testing/test_python.py
--- a/testing/test_python.py
+++ b/testing/test_python.py
@@ -1551,3 +1551,21 @@
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*",
+ ])
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list