[py-svn] r38560 - in py/trunk/py/test: . testing
fijal at codespeak.net
fijal at codespeak.net
Mon Feb 12 14:20:50 CET 2007
Author: fijal
Date: Mon Feb 12 14:20:49 2007
New Revision: 38560
Modified:
py/trunk/py/test/collect.py
py/trunk/py/test/testing/test_config.py
Log:
Compare collectors by id rather than by name. It needs to be rethought
a bit.
Modified: py/trunk/py/test/collect.py
==============================================================================
--- py/trunk/py/test/collect.py (original)
+++ py/trunk/py/test/collect.py Mon Feb 12 14:20:49 2007
@@ -65,10 +65,11 @@
return "<%s %r>" %(self.__class__.__name__, self.name)
def __eq__(self, other):
- try:
- return self.name == other.name and self.parent == other.parent
- except AttributeError:
- return False
+ #try:
+ # return self.name == other.name and self.parent == other.parent
+ #except AttributeError:
+ # return False
+ return self is other
def __hash__(self):
return hash((self.name, self.parent))
@@ -347,7 +348,7 @@
return self._name2items.get(name, None)
-class Module(FSCollector, PyCollectorMixin):
+class Module(FSCollector, PyCollectorMixin):
def run(self):
if getattr(self.obj, 'disabled', 0):
return []
@@ -358,7 +359,7 @@
if res is None:
attr = getattr(self.obj, name, None)
if attr is not None:
- res = self.makeitem(name, attr, usefilters=False)
+ return self.makeitem(name, attr, usefilters=False)
return res
def startcapture(self):
@@ -403,9 +404,9 @@
return []
return ["()"]
- def join(self, name):
- assert name == '()'
- return self.Instance(name, self)
+ def join(self, name):
+ assert name == '()'
+ return self.Instance(name, self)
def setup(self):
setup_class = getattr(self.obj, 'setup_class', None)
Modified: py/trunk/py/test/testing/test_config.py
==============================================================================
--- py/trunk/py/test/testing/test_config.py (original)
+++ py/trunk/py/test/testing/test_config.py Mon Feb 12 14:20:49 2007
@@ -397,7 +397,8 @@
assert trail[0] == a.relto(config.topdir)
assert trail[1] == ('trail.py',)
col2 = config._getcollector(trail)
- assert col2.listchain() == col.listchain()
+ assert [i.name for i in col2.listchain()] == \
+ [i.name for i in col.listchain()]
def test_get_collector_trail_topdir_and_beyond(self):
config = py.test.config._reparse([self.tmpdir])
More information about the pytest-commit
mailing list