Avoid deprecated TestCase functions in unit tests. (#76678)
* Avoid deprecated TestCase functions in unit tests. * Add assertRaisesRegex for Python 2.7. * Fix indentation.
This commit is contained in:
6
test/units/plugins/cache/test_cache.py
vendored
6
test/units/plugins/cache/test_cache.py
vendored
@ -185,9 +185,9 @@ class TestFactCache(unittest.TestCase):
|
||||
# See https://github.com/ansible/ansible/issues/18751
|
||||
# Note no fact_connection config set, so this will fail
|
||||
with mock.patch('ansible.constants.CACHE_PLUGIN', 'json'):
|
||||
self.assertRaisesRegexp(AnsibleError,
|
||||
"Unable to load the facts cache plugin.*json.*",
|
||||
FactCache)
|
||||
self.assertRaisesRegex(AnsibleError,
|
||||
"Unable to load the facts cache plugin.*json.*",
|
||||
FactCache)
|
||||
|
||||
def test_update(self):
|
||||
self.cache.update({'cache_key': {'key2': 'updatedvalue'}})
|
||||
|
||||
Reference in New Issue
Block a user