absltest.skipThisClass: correct type signature.
The existing signature causes type checking failures in code that combines
`skipThisClass` with `abc.ABC` and `@override`.
PiperOrigin-RevId: 827585497
diff --git a/absl/testing/absltest.py b/absl/testing/absltest.py
index ffafa0d..a16685e 100644
--- a/absl/testing/absltest.py
+++ b/absl/testing/absltest.py
@@ -2386,7 +2386,9 @@
return False
-def skipThisClass(reason: str) -> Callable[[_T], _T]:
+def skipThisClass(
+ reason: str,
+) -> Callable[[Type[_T]], Type[_T]]:
"""Skip tests in the decorated TestCase, but not any of its subclasses.
This decorator indicates that this class should skip all its tests, but not
diff --git a/absl/testing/tests/absltest_test.py b/absl/testing/tests/absltest_test.py
index fb315ad..9b8363e 100644
--- a/absl/testing/tests/absltest_test.py
+++ b/absl/testing/tests/absltest_test.py
@@ -2677,9 +2677,13 @@
def test_incorrect_decorator_subclass(self):
with self.assertRaises(TypeError):
+ # Disabling type checking because pytype correctly picks up that
+ # @absltest.skipThisClass is being used incorrectly.
+ # pytype: disable=wrong-arg-types
@absltest.skipThisClass('reason')
def test_method(): # pylint: disable=unused-variable
pass
+ # pytype: enable=wrong-arg-types
def test_correct_decorator_class(self):