Unit tests: make set_module_args() a context manager, and remove copies of it in some tests (#9838)

Make set_module_args() a context manager, and remove copies of set_module_args().

Prepares for Data Tagging.
This commit is contained in:
Felix Fontein 2025-03-07 07:21:03 +01:00 committed by GitHub
parent 402f725424
commit a1781d09dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
84 changed files with 4043 additions and 4302 deletions

View file

@ -13,9 +13,9 @@ from ansible_collections.community.general.tests.unit.plugins.modules.utils impo
def test_terraform_without_argument(capfd):
set_module_args({})
with pytest.raises(SystemExit) as results:
terraform.main()
with set_module_args({}):
with pytest.raises(SystemExit) as results:
terraform.main()
out, err = capfd.readouterr()
assert not err