diff --git a/changelogs/fragments/83327.yml b/changelogs/fragments/83327.yml new file mode 100644 index 00000000000..8cdd448aa5d --- /dev/null +++ b/changelogs/fragments/83327.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - fixed unit test test_borken_cowsay to address mock not been properly applied when existing unix system already have cowsay installed. \ No newline at end of file diff --git a/test/units/utils/display/test_broken_cowsay.py b/test/units/utils/display/test_broken_cowsay.py index 854b78b89e3..50691c229b3 100644 --- a/test/units/utils/display/test_broken_cowsay.py +++ b/test/units/utils/display/test_broken_cowsay.py @@ -10,13 +10,12 @@ from unittest.mock import MagicMock def test_display_with_fake_cowsay_binary(capsys, mocker): - display = Display() mocker.patch("ansible.constants.ANSIBLE_COW_PATH", "./cowsay.sh") - mock_popen = MagicMock() mock_popen.return_value.returncode = 1 mocker.patch("subprocess.Popen", mock_popen) + display = Display() assert not hasattr(display, "cows_available") assert display.b_cowsay is None