From 0b973a3cfe41751cbd5b433bf9fc1e1ca3737f1c Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 18 Aug 2021 12:07:29 +0900 Subject: [PATCH] Replace deprecated assertRaisesRegexp The assertRaisesRegexp method has been deprecated since it was renamed to assertRaisesRegex in Python 3.2 . https: //docs.python.org/3/library/unittest.html#deprecated-aliases Change-Id: I3d6a1014efd3e29bd45ab0aad0def33f22af95c1 --- designate/tests/test_central/test_decorator.py | 2 +- designate/tests/unit/backend/test_ns1.py | 4 ++-- designate/tests/unit/backend/test_pdns4.py | 8 ++++---- designate/tests/unit/workers/test_zone_tasks.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/designate/tests/test_central/test_decorator.py b/designate/tests/test_central/test_decorator.py index 79f7126af..1d9826433 100644 --- a/designate/tests/test_central/test_decorator.py +++ b/designate/tests/test_central/test_decorator.py @@ -67,7 +67,7 @@ class CentralDecoratorTests(CentralTestCase): def mock_not_creating_new_zone(cls, context, record): pass - self.assertRaisesRegexp( + self.assertRaisesRegex( Exception, 'Failed to determine zone id for ' 'synchronized operation', diff --git a/designate/tests/unit/backend/test_ns1.py b/designate/tests/unit/backend/test_ns1.py index edb15de81..961cfc152 100644 --- a/designate/tests/unit/backend/test_ns1.py +++ b/designate/tests/unit/backend/test_ns1.py @@ -158,7 +158,7 @@ class NS1BackendTestCase(designate.tests.TestCase): status_code=404, ) - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.Backend, '500 Server Error: None for url: ' '%s' % self.api_address, @@ -206,7 +206,7 @@ class NS1BackendTestCase(designate.tests.TestCase): req_mock.delete(self.api_address, status_code=500) req_mock.get(self.api_address, status_code=200) - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.Backend, '500 Server Error: None for url: ' '%s' % self.api_address, diff --git a/designate/tests/unit/backend/test_pdns4.py b/designate/tests/unit/backend/test_pdns4.py index 9cfc779e7..07b4a544e 100644 --- a/designate/tests/unit/backend/test_pdns4.py +++ b/designate/tests/unit/backend/test_pdns4.py @@ -161,7 +161,7 @@ class PDNS4BackendTestCase(designate.tests.TestCase): status_code=500, ) - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.Backend, '500 Server Error: None for url: ' '%s/localhost/zones' % self.base_address, @@ -229,7 +229,7 @@ class PDNS4BackendTestCase(designate.tests.TestCase): status_code=404, ) - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.Backend, '500 Server Error: None for url: ' '%s/localhost/zones' % self.base_address, @@ -255,7 +255,7 @@ class PDNS4BackendTestCase(designate.tests.TestCase): status_code=500, ) - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.Backend, '500 Server Error: None for url: ' '%s/localhost/zones' % self.base_address, @@ -326,7 +326,7 @@ class PDNS4BackendTestCase(designate.tests.TestCase): status_code=200, ) - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.Backend, '500 Server Error: None for url: ' '%s/localhost/zones' % self.base_address, diff --git a/designate/tests/unit/workers/test_zone_tasks.py b/designate/tests/unit/workers/test_zone_tasks.py index 25b9c41af..2f45f1c2f 100644 --- a/designate/tests/unit/workers/test_zone_tasks.py +++ b/designate/tests/unit/workers/test_zone_tasks.py @@ -312,7 +312,7 @@ class TestZoneActor(oslotest.base.BaseTestCase): ) def test_invalid_action(self): - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.BadAction, 'Unexpected action: BAD', self.actor._validate_action, 'BAD' )