Browse Source

Replace assertRaisesRegexp with assertRaisesRegex

qinling don't use the unittest module directly, but using unittest2 instead
assertRaisesRegexp is deprecated in unittest2 by assertRaisesRegex, see:
https://hg.python.org/unittest2/rev/27d6829cd8fa#l1.213

Change-Id: I255e2c0453e76d6cb4dd2832d723b6c35241ca9d
changes/86/563486/3
wangqi 3 years ago
parent
commit
710b613136
  1. 2
      qinling/tests/unit/engine/test_default_engine.py
  2. 6
      qinling/tests/unit/storage/test_file_system.py

2
qinling/tests/unit/engine/test_default_engine.py

@ -70,7 +70,7 @@ class TestDefaultEngine(base.DbTestCase):
self.orchestrator.delete_pool.assert_called_once_with(
runtime_id)
self.assertRaisesRegexp(
self.assertRaisesRegex(
exc.DBEntityNotFoundError,
"^Runtime not found \[id=%s\]$" % runtime_id,
db_api.get_runtime, runtime_id)

6
qinling/tests/unit/storage/test_file_system.py

@ -72,7 +72,7 @@ class TestFileSystemStorage(base.BaseTest):
function_data = "Some data".encode('utf8')
not_a_md5sum = "Not a md5sum"
self.assertRaisesRegexp(
self.assertRaisesRegex(
exc.InputException,
"^Package md5 mismatch\.$",
self.storage.store,
@ -96,7 +96,7 @@ class TestFileSystemStorage(base.BaseTest):
# For python3, data should be encoded into bytes before hashing.
function_data = "Some data".encode('utf8')
self.assertRaisesRegexp(
self.assertRaisesRegex(
exc.InputException,
"^Package is not a valid ZIP package\.$",
self.storage.store,
@ -133,7 +133,7 @@ class TestFileSystemStorage(base.BaseTest):
exists_mock.return_value = False
function = self.rand_name('function', prefix='TestFileSystemStorage')
self.assertRaisesRegexp(
self.assertRaisesRegex(
exc.StorageNotFoundException,
"^Package of function %s for project %s not found\.$" % (
function, self.project_id),

Loading…
Cancel
Save