2222import types
2323import unittest
2424from unittest .case import SkipTest
25- import warnings
2625
2726from testtools .compat import reraise
2827from testtools import content
5049)
5150
5251
53- class TestSkipped (SkipTest ):
54- """Raised within TestCase.run() when a test is skipped."""
55-
56- def __init__ (self , * args , ** kwargs ):
57- warnings .warn (
58- "Use SkipTest from unittest instead." ,
59- DeprecationWarning ,
60- stacklevel = 2 ,
61- )
62- super ().__init__ (* args , ** kwargs )
63-
64-
6552class _UnexpectedSuccess (Exception ):
6653 """An unexpected success was raised.
6754
@@ -293,17 +280,6 @@ def __repr__(self):
293280 # We add id to the repr because it makes testing testtools easier.
294281 return f"<{ self .id ()} id=0x{ id (self ):0x} >"
295282
296- def _deprecate (original_func ):
297- def deprecated_func (* args , ** kwargs ):
298- warnings .warn (
299- "Please use {0} instead." .format (original_func .__name__ ),
300- DeprecationWarning ,
301- stacklevel = 2 ,
302- )
303- return original_func (* args , ** kwargs )
304-
305- return deprecated_func
306-
307283 def addDetail (self , name , content_object ):
308284 """Add a detail to be reported with this test's outcome.
309285
@@ -355,15 +331,6 @@ def skipTest(self, reason):
355331 """
356332 raise self .skipException (reason )
357333
358- def skip (self , reason ):
359- """DEPRECATED: Use skipTest instead."""
360- warnings .warn (
361- "Only valid in 1.8.1 and earlier. Use skipTest instead." ,
362- DeprecationWarning ,
363- stacklevel = 2 ,
364- )
365- self .skipTest (reason )
366-
367334 def _formatTypes (self , classOrIterable ):
368335 """Format a class or a bunch of classes for display in an error."""
369336 className = getattr (classOrIterable , "__name__" , None )
@@ -418,8 +385,6 @@ def assertEqual(self, expected, observed, message=""):
418385 matcher = _FlippedEquals (expected )
419386 self .assertThat (observed , matcher , message )
420387
421- failUnlessEqual = assertEquals = _deprecate (assertEqual )
422-
423388 def assertIn (self , needle , haystack , message = "" ):
424389 """Assert that needle is in haystack."""
425390 self .assertThat (haystack , Contains (needle ), message )
@@ -495,8 +460,6 @@ def match(self, matchee):
495460 self .assertThat (our_callable , matcher )
496461 return capture .matchee
497462
498- failUnlessRaises = _deprecate (assertRaises )
499-
500463 def assertThat (self , matchee , matcher , message = "" , verbose = False ):
501464 """Assert that matchee is matched by matcher.
502465
@@ -508,8 +471,6 @@ def assertThat(self, matchee, matcher, message="", verbose=False):
508471 if mismatch_error is not None :
509472 raise mismatch_error
510473
511- assertItemsEqual = _deprecate (unittest .TestCase .assertCountEqual )
512-
513474 def addDetailUniqueName (self , name , content_object ):
514475 """Add a detail to the test, but ensure it's name is unique.
515476
0 commit comments