[py-svn] r33639 - py/dist/py/test/rsession
fijal at codespeak.net
fijal at codespeak.net
Tue Oct 24 11:42:25 CEST 2006
Author: fijal
Date: Tue Oct 24 11:42:23 2006
New Revision: 33639
Modified:
py/dist/py/test/rsession/rsession.py
Log:
Dirty hack to allow display to work better, needs some tests.
Modified: py/dist/py/test/rsession/rsession.py
==============================================================================
--- py/dist/py/test/rsession/rsession.py (original)
+++ py/dist/py/test/rsession/rsession.py Tue Oct 24 11:42:23 2006
@@ -33,8 +33,9 @@
remote_options = RemoteOptions({'we_are_remote':False})
class AbstractReporter(object):
- def __init__(self, config, hosts):
+ def __init__(self, config, hosts, pkgdir=""):
self.config = config
+ self.pkgdir = pkgdir
self.failed_tests_outcome = []
self.skipped_tests_outcome = []
self.out = getout(py.std.sys.stdout)
@@ -288,10 +289,20 @@
def report_ItemStart(self, event):
item = event.item
if isinstance(item, py.test.collect.Module):
+ # XXX This is a terrible hack, I don't like it
+ # and will rewrite it at some point
self.count = 0
lgt = len(list(event.item.tryiter()))
self.lgt = lgt
- self.out.write("%s[%d] " % (item.name, lgt))
+ # print names relative to current workdir
+ name = "/".join(item.listnames())
+ local = str(py.path.local())
+ d = str(self.pkgdir.dirpath().dirpath())
+ if local.startswith(d):
+ local = local[len(d) + 1:]
+ if name.startswith(local):
+ name = name[len(local) + 1:]
+ self.out.write("%s[%d] " % (name, lgt))
def hangs(self):
pass
@@ -329,7 +340,7 @@
return pkgpath
getpkgdir = staticmethod(getpkgdir)
- def init_reporter(self, reporter, sshhosts, reporter_class):
+ def init_reporter(self, reporter, sshhosts, reporter_class, arg=""):
try:
# XXX: use it like a command line option, but how?
startserverflag = self.config.getinitialvalue("startserver")
@@ -343,7 +354,10 @@
reporter = exported_methods.report
start_server()
elif reporter is None:
- reporter_instance = reporter_class(self.config, sshhosts)
+ if arg:
+ reporter_instance = reporter_class(self.config, sshhosts, self.getpkgdir(arg))
+ else:
+ reporter_instance = reporter_class(self.config, sshhosts)
reporter = reporter_instance.report
checkfun = lambda : self.config.option.exitfirst and \
reporter_instance.is_failing()
@@ -433,7 +447,7 @@
py.magic.invoke(assertion=1)
reporter, checkfun, startserverflag = self.init_reporter(reporter,
- sshhosts, LocalReporter)
+ sshhosts, LocalReporter, args[0])
if shouldstop:
checkfun = shouldstop
More information about the py-svn
mailing list