Remove assertRaisesRegex

assertRaisesRegex is now included in unittest, we no longer need to keep
an internal implementation

Change-Id: I749a9f214c0fd0215cc6b88f67bfc3d72274746f
This commit is contained in:
Gregory Thiemonge 2024-04-29 07:28:55 -04:00
parent 448cf4136b
commit db33b6eb52
1 changed files with 0 additions and 26 deletions

View File

@ -19,9 +19,7 @@ from unittest import mock
import fixtures
from oslotest import base
from testtools import compat
from testtools import matchers
from testtools import testcase
from taskflow import exceptions
from taskflow.tests import fixtures as taskflow_fixtures
@ -122,30 +120,6 @@ class TestCase(base.BaseTestCase):
self.assertRaises(exc_class, access_func)
def assertRaisesRegex(self, exc_class, pattern, callable_obj,
*args, **kwargs):
# TODO(harlowja): submit a pull/review request to testtools to add
# this method to there codebase instead of having it exist in ours
# since it really doesn't belong here.
class ReRaiseOtherTypes(object):
def match(self, matchee):
if not issubclass(matchee[0], exc_class):
class CaptureMatchee(object):
def match(self, matchee):
self.matchee = matchee[1]
capture = CaptureMatchee()
matcher = matchers.Raises(matchers.MatchesAll(ReRaiseOtherTypes(),
our_callable = testcase.Nullary(callable_obj, *args, **kwargs)
self.assertThat(our_callable, matcher)
return capture.matchee
def assertGreater(self, first, second):
matcher = matchers.GreaterThan(first)
self.assertThat(second, matcher)