From db33b6eb52a86f40eea809618b9ded59932ecc59 Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Mon, 29 Apr 2024 07:28:55 -0400 Subject: [PATCH] Remove assertRaisesRegex assertRaisesRegex is now included in unittest, we no longer need to keep an internal implementation Change-Id: I749a9f214c0fd0215cc6b88f67bfc3d72274746f --- taskflow/test.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/taskflow/test.py b/taskflow/test.py index 67bf89de5..f91a910e3 100644 --- a/taskflow/test.py +++ b/taskflow/test.py @@ -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): - compat.reraise(*matchee) - - class CaptureMatchee(object): - def match(self, matchee): - self.matchee = matchee[1] - - capture = CaptureMatchee() - matcher = matchers.Raises(matchers.MatchesAll(ReRaiseOtherTypes(), - matchers.MatchesException(exc_class, - pattern), - capture)) - 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)