Silenced warnings in deprecation tests.
@@ -51,6 +51,8 @@ class RenameMethodsTests(SimpleTestCase):
"""
Ensure `old` complains when only `old` is defined.
"""
+ msg = '`Manager.old` method should be renamed `new`.'
+ with self.assertWarnsMessage(DeprecationWarning, msg):
class Manager(metaclass=RenameManagerMethods):
def old(self):
pass
@@ -74,6 +76,8 @@ class RenameMethodsTests(SimpleTestCase):
def new(self):
pass
+ msg = '`Deprecated.old` method should be renamed `new`.'
+ with self.assertWarnsMessage(DeprecationWarning, msg):
class Deprecated(Renamed):
def old(self):
super().old()
@@ -93,6 +97,8 @@ class RenameMethodsTests(SimpleTestCase):
Ensure the correct warnings are raised when a class that renamed
`old` subclass one that didn't.
"""
+ msg = '`Deprecated.old` method should be renamed `new`.'
+ with self.assertWarnsMessage(DeprecationWarning, msg):
class Deprecated(metaclass=RenameManagerMethods):
def old(self):
pass
@@ -130,6 +136,8 @@ class RenameMethodsTests(SimpleTestCase):
def old(self):
super().old()
+ msg = '`DeprecatedMixin.old` method should be renamed `new`.'
+ with self.assertWarnsMessage(DeprecationWarning, msg):
class Deprecated(DeprecatedMixin, RenamedMixin, Renamed):
pass
