diff options
Diffstat (limited to 'logilab/common/testlib.py')
-rw-r--r-- | logilab/common/testlib.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/logilab/common/testlib.py b/logilab/common/testlib.py index fe5e3c4..4fb3221 100644 --- a/logilab/common/testlib.py +++ b/logilab/common/testlib.py @@ -58,7 +58,7 @@ from mypy_extensions import NoReturn import builtins import doctest -from logilab.common.deprecation import class_deprecated, deprecated +from logilab.common.deprecation import class_deprecated, callable_deprecated import unittest as unittest_legacy @@ -83,13 +83,15 @@ __all__ = ["unittest_main", "find_tests", "nocoverage", "pause_trace"] DEFAULT_PREFIXES = ("test", "regrtest", "smoketest", "unittest", "func", "validation") -is_generator = deprecated("[lgc 0.63] use inspect.isgeneratorfunction")(isgeneratorfunction) +is_generator = callable_deprecated("[lgc 0.63] use inspect.isgeneratorfunction")( + isgeneratorfunction +) # used by unittest to count the number of relevant levels in the traceback __unittest = 1 -@deprecated("with_tempdir is deprecated, use tempfile.TemporaryDirectory.") +@callable_deprecated("with_tempdir is deprecated, use tempfile.TemporaryDirectory.") def with_tempdir(callable: Callable) -> Callable: """A decorator ensuring no temporary file left when the function return Work only for temporary file created with the tempfile module""" @@ -556,9 +558,9 @@ class TestCase(unittest.TestCase): assertCountEqual = unittest.TestCase.assertItemsEqual -TestCase.assertItemsEqual = deprecated("assertItemsEqual is deprecated, use assertCountEqual")( - TestCase.assertItemsEqual -) +TestCase.assertItemsEqual = callable_deprecated( + "assertItemsEqual is deprecated, use assertCountEqual" +)(TestCase.assertItemsEqual) class SkippedSuite(unittest.TestSuite): |