ansible/test/units/plugins
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
..
action become - stop using play context in more places (#62373) 2019-11-18 05:32:56 +10:00
cache Improve testing of FactCache (#55739) 2019-06-10 16:26:24 -04:00
callback Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00
cliconf Unit tests: remove unused imports (#59812) 2019-08-02 17:18:14 +02:00
connection new connection plugin aws_ssm (#49652) 2020-01-11 15:22:01 +10:00
filter Clean up flake8 for ansible.netcommon collection (#65842) 2019-12-16 08:24:38 -05:00
httpapi fix all modules to be able to get parameter with value false (very important fix) (#65040) 2019-11-20 12:09:40 +05:30
inventory Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00
loader_fixtures Don't cache duplicate plugin names (#34420) 2018-01-04 16:47:23 -06:00
lookup Remove with statement for pytest-mock unit tests 2020-01-29 13:29:40 -08:00
shell Add support for Windows hosts in the SSH connection plugin (#47732) 2019-03-07 16:38:02 -08:00
strategy throttle: fix linear based strategies (#65422) 2020-01-24 08:18:08 -06:00
terminal Remove empty setUp/tearDown/tearDownClass methods in test classes. 2019-11-06 08:14:29 -08:00
vars
__init__.py
test_plugins.py Remove empty setUp/tearDown/tearDownClass methods in test classes. 2019-11-06 08:14:29 -08:00