aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-06-14 08:44:54 -0500
committerBenjamin Peterson <benjamin@python.org>2011-06-14 08:44:54 -0500
commit2502aea93d1e35e0907f3f22641585c07912bb4d (patch)
treef45cff170576a835a3c093bab975150dedeab292 /_pytest/pytester.py
parentfix for 2.5 (diff)
downloadpypy-2502aea93d1e35e0907f3f22641585c07912bb4d.tar.gz
pypy-2502aea93d1e35e0907f3f22641585c07912bb4d.tar.bz2
pypy-2502aea93d1e35e0907f3f22641585c07912bb4d.zip
update py.test again (now with 2.5 support)
Diffstat (limited to '_pytest/pytester.py')
-rw-r--r--_pytest/pytester.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/_pytest/pytester.py b/_pytest/pytester.py
index 619bba9886..8bfa3d37bd 100644
--- a/_pytest/pytester.py
+++ b/_pytest/pytester.py
@@ -6,7 +6,7 @@ import re
import inspect
import time
from fnmatch import fnmatch
-from _pytest.main import Session
+from _pytest.main import Session, EXIT_OK
from py.builtin import print_
from _pytest.core import HookRelay
@@ -292,13 +292,19 @@ class TmpTestdir:
assert '::' not in str(arg)
p = py.path.local(arg)
x = session.fspath.bestrelpath(p)
- return session.perform_collect([x], genitems=False)[0]
+ config.hook.pytest_sessionstart(session=session)
+ res = session.perform_collect([x], genitems=False)[0]
+ config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
+ return res
def getpathnode(self, path):
- config = self.parseconfig(path)
+ config = self.parseconfigure(path)
session = Session(config)
x = session.fspath.bestrelpath(path)
- return session.perform_collect([x], genitems=False)[0]
+ config.hook.pytest_sessionstart(session=session)
+ res = session.perform_collect([x], genitems=False)[0]
+ config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
+ return res
def genitems(self, colitems):
session = colitems[0].session
@@ -312,7 +318,9 @@ class TmpTestdir:
config = self.parseconfigure(*args)
rec = self.getreportrecorder(config)
session = Session(config)
+ config.hook.pytest_sessionstart(session=session)
session.perform_collect()
+ config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
return session.items, rec
def runitem(self, source):
@@ -382,6 +390,8 @@ class TmpTestdir:
c.basetemp = py.path.local.make_numbered_dir(prefix="reparse",
keep=0, rootdir=self.tmpdir, lock_timeout=None)
c.parse(args)
+ c.pluginmanager.do_configure(c)
+ self.request.addfinalizer(lambda: c.pluginmanager.do_unconfigure(c))
return c
finally:
py.test.config = oldconfig