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:
Matt Clay
2022-01-07 12:31:11 -08:00
committed by GitHub
parent ace04087e7
commit 97104f1221
15 changed files with 229 additions and 225 deletions

View File

@ -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'}})