ansible/test/units/module_utils
Rick Elrod e2a57414f4 Remove with statement for pytest-mock unit tests
As per:
https://github.com/pytest-dev/pytest-mock#note-about-usage-as-context-manager
pytest-mock is not meant to be used within a `with` context or as a
decorator. Instead, pytest-mock will automatically unpatch the mocked
methods when each test is complete.

In newer pytest-mock, this use actually throws an exception and causes
the tests to fail.

This hasn't been hit in Ansible's CI yet, because the docker image
that the tests run in uses an older version of pytest-mock. However,
there is no constraint on the upper bound of pytest-mock in
test/lib/ansible_test/_data/requirements/constraints.txt which means
that when running the tests locally, outside of that docker image, the
tests never pass.

This patch removes the `with` context in each such case.

Signed-off-by: Rick Elrod <rick@elrod.me>
2020-01-29 13:29:40 -08:00
..
acme crypto modules: fix sanity errors (#60046) 2019-08-18 05:37:57 +02:00
aws
basic Add mechanism for storing warnings and deprecations outside of AnsibleModule (#58993) 2020-01-28 12:12:14 -05:00
cloud Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00
common Add mechanism for storing warnings and deprecations outside of AnsibleModule (#58993) 2020-01-28 12:12:14 -05:00
docker docker: fix sanity errors (#60047) 2019-08-09 23:50:11 +02:00
ec2 Sanity test fixups - AWS related tests (#64093) 2019-10-30 09:48:59 -07:00
facts Remove with statement for pytest-mock unit tests 2020-01-29 13:29:40 -08:00
gcp Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00
hwc Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00
identity/keycloak keycloak: improve testability of authentification (#57611) 2019-08-29 10:15:47 +02:00
json_utils Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00
net_tools unit tests: remove unused imports (#59636) 2019-07-26 10:53:31 -04:00
network Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00
parsing
postgresql Postgres module_utils: add get_connect_params + unit tests (#58067) 2019-06-19 06:49:19 -07:00
remote_management Adding dell ome device_info module (#53438) 2019-06-10 06:41:48 -04:00
urls ansible-galaxy - define multiple galaxy instances in ansible.cfg (#60553) 2019-08-21 07:49:05 +10:00
xenserver XenServer: Update docs with recent changes in XenAPI python lib and branding (#63728) 2019-10-22 21:04:16 +05:30
__init__.py
conftest.py
test_database.py
test_distribution_version.py Get minor version number for CentOS and Debian (#57814) 2019-06-28 19:21:35 -04:00
test_distro.py
test_ec2.py Sanity test fixups - AWS related tests (#64093) 2019-10-30 09:48:59 -07:00
test_hetzner.py Hetzner failover IP: refactoring (#56203) 2019-05-10 08:33:51 +02:00
test_known_hosts.py unit tests: remove unused imports (#59636) 2019-07-26 10:53:31 -04:00
test_kubevirt.py kubevirt: more unit tests (#57739) 2019-06-25 20:06:13 +10:00
test_netapp.py Improved netapp module utility for E-Series. (#59527) 2019-08-01 13:24:38 -04:00
test_text.py Wrap CLI Passwords with AnsibleUnsafeText, ensure unsafe context is not lost during encode/decode (#63351) 2019-10-11 09:17:10 -05:00
test_utm_utils.py
test_vmware.py VMware: not ssl.SSLContext if validate_certs false (#57185) 2019-09-09 21:41:46 +05:30