mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 08:03:05 +02:00
[stable-2.16] Fix Test failure with cowsay installed/present (#83350)
(cherry picked from commit e07b4edc54)
Co-authored-by: MajesticMagikarpKing <69774548+yctomwang@users.noreply.github.com>
This commit is contained in:
co-authored by
MajesticMagikarpKing
parent
a97e39b90f
commit
1ef184ba2d
@@ -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.
|
||||
@@ -12,13 +12,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
|
||||
|
||||
Reference in New Issue
Block a user