[py-svn] r7153 - in py/dist/py/test: . report/text
hpk at codespeak.net
hpk at codespeak.net
Fri Oct 29 15:44:31 CEST 2004
Author: hpk
Date: Fri Oct 29 15:44:31 2004
New Revision: 7153
Modified:
py/dist/py/test/collect.py
py/dist/py/test/drive.py
py/dist/py/test/report/text/reporter.py
Log:
- improved --collectonly output (now shows items)
- fixes, disabled a "samefile()" check because they
don't work reliably when you have multiple mount
points (as happens with autofs && symlinks where
path != realpath(path) )
Modified: py/dist/py/test/collect.py
==============================================================================
--- py/dist/py/test/collect.py (original)
+++ py/dist/py/test/collect.py Fri Oct 29 15:44:31 2004
@@ -89,7 +89,9 @@
l = []
for extpy in self.extpy.listdir():
for meth in self.yielders:
+ #print "looking at", extpy
for x in meth(extpy):
+ #print "found", x
x.fspath = self.extpy.root
sortvalue = self.getsortvalue(x)
l.append((sortvalue, x))
@@ -131,8 +133,8 @@
def collect_function(self, extpy):
if extpy.check(func=1, basestarts='test_'):
- if self.extpy.samefile(extpy):
- yield self.Item(extpy)
+ #if self.extpy.samefile(extpy): not nfs/different mountpoint safe
+ yield self.Item(extpy)
def collect_class(self, extpy):
#print "checking %r (extpy: %r)" % (extpy.resolve(), extpy)
Modified: py/dist/py/test/drive.py
==============================================================================
--- py/dist/py/test/drive.py (original)
+++ py/dist/py/test/drive.py Fri Oct 29 15:44:31 2004
@@ -53,11 +53,7 @@
if self._channel and self._channel.isclosed():
raise SystemExit, "Channel is closed"
if isinstance(obj, py.test.Item):
- if not self.option.collectonly:
- #if self.option.args:
- # if str(obj.path).find(self.option.args[0]) == -1:
- # return
- self.runitem(obj)
+ self.runitem(obj)
elif isinstance(obj, py.test.collect.Collector):
self.runcollector(obj)
elif isinstance(obj, py.test.collect.Collector.Error):
@@ -88,20 +84,21 @@
def runitem(self, item):
self.reporter.startitem(item)
- try:
- res = item.execute(self) or item.Passed()
- except item.Outcome, res:
- res.excinfo = py.std.sys.exc_info()
- except (KeyboardInterrupt, SystemExit):
- raise
- except:
- res = item.Failed(excinfo=py.std.sys.exc_info())
- res.item = item
- self.reporter.enditem(res)
- if isinstance(res, (item.Failed,)):
- self._failed.append(item)
- if py.test.config.option.exitfirstproblem:
- raise self.Exit(res.item)
+ if not self.option.collectonly:
+ try:
+ res = item.execute(self) or item.Passed()
+ except item.Outcome, res:
+ res.excinfo = py.std.sys.exc_info()
+ except (KeyboardInterrupt, SystemExit):
+ raise
+ except:
+ res = item.Failed(excinfo=py.std.sys.exc_info())
+ res.item = item
+ self.reporter.enditem(res)
+ if isinstance(res, (item.Failed,)):
+ self._failed.append(item)
+ if py.test.config.option.exitfirstproblem:
+ raise self.Exit(res.item)
def setup_path(self, extpy):
""" setup objects along the path to the test-method
@@ -154,6 +151,6 @@
self._instance = method.im_class()
method = method.__get__(self._instance, method.im_class)
if hasattr(self._instance, 'setup_method'):
- print "execting setup", self._instance.setup_method
+ #print "execting setup", self._instance.setup_method
self._instance.setup_method(method)
return (method, getattr(self._instance, 'teardown_method', None))
Modified: py/dist/py/test/report/text/reporter.py
==============================================================================
--- py/dist/py/test/report/text/reporter.py (original)
+++ py/dist/py/test/report/text/reporter.py Fri Oct 29 15:44:31 2004
@@ -32,9 +32,7 @@
self.summary = self.Summary()
self.summary.option = self.option = py.test.config.option
- def start(self, conf=None):
- if conf is not None and conf.mypath is not None:
- self.out.line("using %s" % conf.mypath)
+ def start(self):
self.out.sep("=", "test process starts")
mode = py.test.config.option.session and 'session/child process' or 'inprocess'
self.out.line("testing-mode: %s" % mode)
@@ -97,6 +95,12 @@
return close_directory
def startitem(self, item):
+ if self.option.collectonly:
+ cols = self._opencollectors
+ if len(cols):
+ print ' ' * len(cols),
+ print "Item", item.extpy.modpath
+ return
if not self.option.nocapture:
from py.__impl__.test.tool.outerrcapture import SimpleOutErrCapture
item.iocapture = SimpleOutErrCapture()
@@ -107,13 +111,15 @@
self._started[item] = now()
def enditem(self, result):
+ if self.option.collectonly:
+ return
endtime = now()
item = result.item
starttime = self._started[item]
del self._started[item]
elapsed = endtime - starttime
item.elapsed = elapsed
-
+
if not self.option.nocapture:
result.out, result.err = item.iocapture.reset()
More information about the pytest-commit
mailing list