[svn r38560] Compare collectors by id rather than by name. It needs to be rethought
a bit. --HG-- branch : trunk
This commit is contained in:
parent
d01fb4a18e
commit
6294a4b189
|
@ -65,10 +65,11 @@ class Collector(object):
|
||||||
return "<%s %r>" %(self.__class__.__name__, self.name)
|
return "<%s %r>" %(self.__class__.__name__, self.name)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
try:
|
#try:
|
||||||
return self.name == other.name and self.parent == other.parent
|
# return self.name == other.name and self.parent == other.parent
|
||||||
except AttributeError:
|
#except AttributeError:
|
||||||
return False
|
# return False
|
||||||
|
return self is other
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash((self.name, self.parent))
|
return hash((self.name, self.parent))
|
||||||
|
@ -347,7 +348,7 @@ class PyCollectorMixin(object):
|
||||||
return self._name2items.get(name, None)
|
return self._name2items.get(name, None)
|
||||||
|
|
||||||
|
|
||||||
class Module(FSCollector, PyCollectorMixin):
|
class Module(FSCollector, PyCollectorMixin):
|
||||||
def run(self):
|
def run(self):
|
||||||
if getattr(self.obj, 'disabled', 0):
|
if getattr(self.obj, 'disabled', 0):
|
||||||
return []
|
return []
|
||||||
|
@ -358,7 +359,7 @@ class Module(FSCollector, PyCollectorMixin):
|
||||||
if res is None:
|
if res is None:
|
||||||
attr = getattr(self.obj, name, None)
|
attr = getattr(self.obj, name, None)
|
||||||
if attr is not None:
|
if attr is not None:
|
||||||
res = self.makeitem(name, attr, usefilters=False)
|
return self.makeitem(name, attr, usefilters=False)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def startcapture(self):
|
def startcapture(self):
|
||||||
|
@ -403,9 +404,9 @@ class Class(PyCollectorMixin, Collector):
|
||||||
return []
|
return []
|
||||||
return ["()"]
|
return ["()"]
|
||||||
|
|
||||||
def join(self, name):
|
def join(self, name):
|
||||||
assert name == '()'
|
assert name == '()'
|
||||||
return self.Instance(name, self)
|
return self.Instance(name, self)
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
setup_class = getattr(self.obj, 'setup_class', None)
|
setup_class = getattr(self.obj, 'setup_class', None)
|
||||||
|
|
|
@ -397,7 +397,8 @@ class TestConfigColitems:
|
||||||
assert trail[0] == a.relto(config.topdir)
|
assert trail[0] == a.relto(config.topdir)
|
||||||
assert trail[1] == ('trail.py',)
|
assert trail[1] == ('trail.py',)
|
||||||
col2 = config._getcollector(trail)
|
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):
|
def test_get_collector_trail_topdir_and_beyond(self):
|
||||||
config = py.test.config._reparse([self.tmpdir])
|
config = py.test.config._reparse([self.tmpdir])
|
||||||
|
|
Loading…
Reference in New Issue