[py-svn] r10712 - in py/branch/py-collect/test: . testing
hpk at codespeak.net
hpk at codespeak.net
Fri Apr 15 21:35:03 CEST 2005
Author: hpk
Date: Fri Apr 15 21:35:03 2005
New Revision: 10712
Modified:
py/branch/py-collect/test/collect.py
py/branch/py-collect/test/testing/test_collect.py
Log:
make lookup of custom Collectors more explicit for filesystem paths.
Modified: py/branch/py-collect/test/collect.py
==============================================================================
--- py/branch/py-collect/test/collect.py (original)
+++ py/branch/py-collect/test/collect.py Fri Apr 15 21:35:03 2005
@@ -45,9 +45,14 @@
raise py.error.ENOENT(fspath)
pkgpath = fspath.pypkgpath()
if pkgpath is None:
- current = Directory(fspath.dirpath()).join(fspath.basename)
- current.parent = None
+ if fspath.check(file=1):
+ clsname = 'Module'
+ else:
+ clsname = 'Directory'
+ fscol = py.test.Config.getvalue(clsname, fspath)
+ current = fscol(fspath)
else:
+ Directory = py.test.Config.getvalue('Directory', pkgpath)
current = Directory(pkgpath)
#print "pkgpath", pkgpath
for name in filter(None, fspath.relto(pkgpath).split(fspath.sep)):
@@ -211,7 +216,8 @@
if x.check(file=1):
return self.Module(x, parent=self)
elif x.check(dir=1):
- return self.Directory(x, parent=self)
+ Directory = py.test.Config.getvalue('Directory', x)
+ return Directory(x, parent=self)
class PyCollectorMixin(object):
def funcnamefilter(self, name):
Modified: py/branch/py-collect/test/testing/test_collect.py
==============================================================================
--- py/branch/py-collect/test/testing/test_collect.py (original)
+++ py/branch/py-collect/test/testing/test_collect.py Fri Apr 15 21:35:03 2005
@@ -160,9 +160,21 @@
from py.__impl__.test.collect import getfscollector
for x in (o, checkfile, checkfile.dirpath()):
- print "checking that %s returns custom items" % (x,)
+ #print "checking that %s returns custom items" % (x,)
col = getfscollector(x)
items = list(col.iteritems())
- print "col", col
+ #print "col", col
assert len(items) == 2
assert items[1].__class__.__name__ == 'MyFunction'
+
+ # test that running a session works from the directories
+ old = o.chdir()
+ try:
+ config, args = py.test.Config.parse([])
+ out = py.std.cStringIO.StringIO()
+ session = config.getsessionclass()(config, out)
+ session.main(args)
+ l = session.getresults(py.test.Item.Passed)
+ assert len(l) == 2
+ finally:
+ old.chdir()
More information about the pytest-commit
mailing list