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. 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): class Manager(metaclass=RenameManagerMethods):
def old(self): def old(self):
pass pass
@ -74,6 +76,8 @@ class RenameMethodsTests(SimpleTestCase):
def new(self): def new(self):
pass pass
msg = '`Deprecated.old` method should be renamed `new`.'
with self.assertWarnsMessage(DeprecationWarning, msg):
class Deprecated(Renamed): class Deprecated(Renamed):
def old(self): def old(self):
super().old() super().old()
@ -93,6 +97,8 @@ class RenameMethodsTests(SimpleTestCase):
Ensure the correct warnings are raised when a class that renamed Ensure the correct warnings are raised when a class that renamed
`old` subclass one that didn't. `old` subclass one that didn't.
""" """
msg = '`Deprecated.old` method should be renamed `new`.'
with self.assertWarnsMessage(DeprecationWarning, msg):
class Deprecated(metaclass=RenameManagerMethods): class Deprecated(metaclass=RenameManagerMethods):
def old(self): def old(self):
pass pass
@ -130,6 +136,8 @@ class RenameMethodsTests(SimpleTestCase):
def old(self): def old(self):
super().old() super().old()
msg = '`DeprecatedMixin.old` method should be renamed `new`.'
with self.assertWarnsMessage(DeprecationWarning, msg):
class Deprecated(DeprecatedMixin, RenamedMixin, Renamed): class Deprecated(DeprecatedMixin, RenamedMixin, Renamed):
pass pass