commit: e3d87341a49253d68e09323321d314b8b1d76b4f
Author: Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Fri Nov 28 23:57:52 2025 +0000
Commit: Brian Harring <ferringb <AT> gmail <DOT> com>
CommitDate: Fri Nov 28 23:58:27 2025 +0000
URL:
https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=e3d87341
chore: deprecated and gut eq_hash_inheritance. It's tests for asserting
py2k/py3k compatibility.
The test has been a no-op for I've no clue how long, but presumably a long
time. Thus
make it a noop'd class that has deprecation notices.
Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
src/snakeoil/test/eq_hash_inheritance.py | 50 +++++---------------------------
tests/test_eq_hash_inheritance.py | 5 ----
2 files changed, 7 insertions(+), 48 deletions(-)
diff --git a/src/snakeoil/test/eq_hash_inheritance.py
b/src/snakeoil/test/eq_hash_inheritance.py
index 5e93bd8..9adf994 100644
--- a/src/snakeoil/test/eq_hash_inheritance.py
+++ b/src/snakeoil/test/eq_hash_inheritance.py
@@ -1,46 +1,10 @@
-from .slot_shadowing import KlassWalker, TargetedNamespaceWalker
+__all__ = ("Test",)
+from ..deprecation import deprecated
-class Test(TargetedNamespaceWalker, KlassWalker):
- target_namespace = "snakeoil"
- singleton = object()
-
- def setup_method(self):
- self._ignore_set = frozenset(self.iter_builtin_targets())
-
- def _should_ignore(self, cls):
- if cls in self._ignore_set:
- return True
-
- if getattr(cls, "__hash__intentionally_disabled__", False):
- return True
-
- namepath = f"{cls.__module__}.{cls.__name__}"
- return not namepath.startswith(self.target_namespace)
-
- def run_check(self, cls):
- for parent in cls.__bases__:
- if parent is object:
- # object sets __hash__/__eq__, which isn't usually
- # intended to be inherited/reused
- continue
- eq = getattr(parent, "__eq__", self.singleton)
- h = getattr(parent, "__hash__", self.singleton)
- if eq == object.__eq__ and h == object.__hash__:
- continue
- if eq and h:
- break
- else:
- return
-
- # pylint: disable=undefined-loop-variable
- # 'parent' is guaranteed to be defined due to the 'else' clause above
- assert getattr(cls, "__hash__") is not None, (
- f"class '{cls.__module__}.{cls.__name__}' had its __hash__ reset, "
- "while it would've inherited __hash__ from parent "
- f"'{parent.__module__}.{parent.__name__}'; this occurs in py3k
when "
- "__eq__ is defined alone. If this is desired behaviour, set "
- "__hash__intentionally_disabled__ to True to explicitly ignore
this"
- " class"
- )
+@deprecated(
+ "snakeoil.test.eq_hash_inheritance.Test is a noop. Remove it from your
tests"
+)
+class Test:
+ """Dead set of tests for asserting py2k/py3k compatibility"""
diff --git a/tests/test_eq_hash_inheritance.py
b/tests/test_eq_hash_inheritance.py
deleted file mode 100644
index a1e186d..0000000
--- a/tests/test_eq_hash_inheritance.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from snakeoil.test.eq_hash_inheritance import Test
-
-
-class Test_Eq_Hash(Test):
- pass