Silenced warnings in deprecation tests.

This commit is contained in:
Jon Dufresne 2018-07-11 06:10:31 -07:00 committed by Tim Graham
parent e4c0878b30
commit e26b780a24
1 changed files with 19 additions and 11 deletions

View File

@ -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