1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/852419a495f8/ Changeset: 852419a495f8 User: hpk42 Date: 2013-12-07 16:39:53 Summary: radically simplify eq/neq with nodes by just using Pythons builtin "is" relationship. The need for comparing two separately instantiated nodes seems to be historic (related to an already-gone mode of pytest-xdist which would re-collect nodes) and not actually needed anymore. Affected #: 3 files
diff -r 25ca40a219a02a9451e7f9cb4c3273a41499f331 -r 852419a495f8de5bd75a5e486c6b1a5815f4cde1 _pytest/main.py --- a/_pytest/main.py +++ b/_pytest/main.py @@ -272,21 +272,11 @@ self._nodeid = x = self._makeid() return x - def _makeid(self): return self.parent.nodeid + "::" + self.name - def __eq__(self, other): - if not isinstance(other, Node): - return False - return (self.__class__ == other.__class__ and - self.name == other.name and self.parent == other.parent) - - def __ne__(self, other): - return not self == other - def __hash__(self): - return hash((self.name, self.parent)) + return hash(self.nodeid) def setup(self): pass diff -r 25ca40a219a02a9451e7f9cb4c3273a41499f331 -r 852419a495f8de5bd75a5e486c6b1a5815f4cde1 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -1087,24 +1087,6 @@ super(Function, self).setup() fillfixtures(self) - def __eq__(self, other): - try: - return (self.name == other.name and - self._args == other._args and - self.parent == other.parent and - self.obj == other.obj and - getattr(self, '_genid', None) == - getattr(other, '_genid', None) - ) - except AttributeError: - pass - return False - - def __ne__(self, other): - return not self == other - - def __hash__(self): - return hash((self.parent, self.name)) scope2props = dict(session=()) scope2props["module"] = ("fspath", "module") diff -r 25ca40a219a02a9451e7f9cb4c3273a41499f331 -r 852419a495f8de5bd75a5e486c6b1a5815f4cde1 testing/python/collect.py --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -287,22 +287,10 @@ pass f1 = pytest.Function(name="name", parent=session, config=config, args=(1,), callobj=func1) + assert f1 == f1 f2 = pytest.Function(name="name",config=config, - args=(1,), callobj=func2, parent=session) - assert not f1 == f2 + callobj=func2, parent=session) assert f1 != f2 - f3 = pytest.Function(name="name", parent=session, config=config, - args=(1,2), callobj=func2) - assert not f3 == f2 - assert f3 != f2 - - assert not f3 == f1 - assert f3 != f1 - - f1_b = pytest.Function(name="name", parent=session, config=config, - args=(1,), callobj=func1) - assert f1 == f1_b - assert not f1 != f1_b def test_issue197_parametrize_emptyset(self, testdir): testdir.makepyfile(""" Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit