ansible/test/units/module_utils/facts
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
..
fixtures extends linux cpuinfo test unit with sparc64 data (#55394) 2019-04-17 12:00:17 -04:00
hardware Remove with statement for pytest-mock unit tests 2020-01-29 13:29:40 -08:00
network unit tests: remove unused imports (#59636) 2019-07-26 10:53:31 -04:00
other Clean up ansible-test references in tests. (#60108) 2019-08-05 14:55:30 -07:00
system
__init__.py
base.py unit tests: remove unused imports (#60462) 2019-08-13 19:21:43 +02:00
test_ansible_collector.py Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00
test_collector.py
test_collectors.py
test_facts.py Transform octal escape sequences in mtab fields (#60122) 2019-08-08 16:31:42 -05:00
test_timeout.py Speed up units using time.sleep by mocking or shortening sleep time (#61064) 2019-08-21 16:52:58 -05:00
test_utils.py