trivial: Replace assertRaisesRegexp with assertRaisesRegex
Change-Id: Ib4549e5b0620729c7a13c06506c68570b1fd0ae7
This commit is contained in:
parent
a5fc6a8211
commit
1e410347f0
@ -43,6 +43,10 @@ warnings.filterwarnings('ignore', module='cryptography|OpenSSL', message=(
|
|||||||
'Support for it is now deprecated in cryptography, '
|
'Support for it is now deprecated in cryptography, '
|
||||||
'and will be removed in a future release.'))
|
'and will be removed in a future release.'))
|
||||||
|
|
||||||
|
if sys.version_info < (3, 2):
|
||||||
|
import unittest
|
||||||
|
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
||||||
|
|
||||||
from eventlet.green import socket
|
from eventlet.green import socket
|
||||||
|
|
||||||
# make unittests pass on all locale
|
# make unittests pass on all locale
|
||||||
|
@ -1896,7 +1896,7 @@ class TestAccountBrokerBeforePerPolicyContainerTrack(
|
|||||||
broker, 'create_policy_stat_table',
|
broker, 'create_policy_stat_table',
|
||||||
side_effect=sqlite3.OperationalError('foobar')):
|
side_effect=sqlite3.OperationalError('foobar')):
|
||||||
with broker.get() as conn:
|
with broker.get() as conn:
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
sqlite3.OperationalError, '.*foobar.*',
|
sqlite3.OperationalError, '.*foobar.*',
|
||||||
broker._migrate_add_storage_policy_index,
|
broker._migrate_add_storage_policy_index,
|
||||||
conn=conn)
|
conn=conn)
|
||||||
|
@ -248,7 +248,7 @@ class TestKeymaster(unittest.TestCase):
|
|||||||
def test_missing_conf_section(self):
|
def test_missing_conf_section(self):
|
||||||
sample_conf = "[default]\nuser = %s\n" % getuser()
|
sample_conf = "[default]\nuser = %s\n" % getuser()
|
||||||
with tmpfile(sample_conf) as conf_file:
|
with tmpfile(sample_conf) as conf_file:
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
ValueError, 'Unable to find keymaster config section in.*',
|
ValueError, 'Unable to find keymaster config section in.*',
|
||||||
keymaster.KeyMaster, self.swift, {
|
keymaster.KeyMaster, self.swift, {
|
||||||
'keymaster_config_path': conf_file})
|
'keymaster_config_path': conf_file})
|
||||||
|
@ -176,7 +176,7 @@ class TestRunDaemon(unittest.TestCase):
|
|||||||
# test missing section
|
# test missing section
|
||||||
sample_conf = "[default]\nuser = %s\n" % getuser()
|
sample_conf = "[default]\nuser = %s\n" % getuser()
|
||||||
with tmpfile(sample_conf) as conf_file:
|
with tmpfile(sample_conf) as conf_file:
|
||||||
self.assertRaisesRegexp(SystemExit,
|
self.assertRaisesRegex(SystemExit,
|
||||||
'Unable to find my-daemon '
|
'Unable to find my-daemon '
|
||||||
'config section in.*',
|
'config section in.*',
|
||||||
daemon.run_daemon, MyDaemon,
|
daemon.run_daemon, MyDaemon,
|
||||||
|
@ -2417,7 +2417,7 @@ log_name = yarr'''
|
|||||||
'foo': 'bar', 'bar': 'baz'}
|
'foo': 'bar', 'bar': 'baz'}
|
||||||
self.assertEqual(result, expected)
|
self.assertEqual(result, expected)
|
||||||
|
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
ValueError, 'Unable to find section3 config section in.*',
|
ValueError, 'Unable to find section3 config section in.*',
|
||||||
utils.readconf, temppath, 'section3')
|
utils.readconf, temppath, 'section3')
|
||||||
os.unlink(temppath)
|
os.unlink(temppath)
|
||||||
|
Loading…
Reference in New Issue
Block a user