Package Details: ansible-core-2.16 2.16.12-1

Git Clone URL: https://aur.archlinux.org/ansible-core-2.16.git (read-only, click to copy)
Package Base: ansible-core-2.16
Description: Radically simple IT automation platform
Upstream URL: https://www.ansible.com
Licenses: GPL-3.0-or-later AND BSD-2-Clause AND PSF-2.0 AND MIT AND Apache-2.0
Conflicts: ansible-core
Provides: ansible-base, ansible-core, python-ansible
Replaces: ansible-base
Submitter: nicolasyang
Maintainer: nicolasyang
Last Packager: nicolasyang
Votes: 1
Popularity: 0.147934
First Submitted: 2024-05-22 05:12 (UTC)
Last Updated: 2024-10-08 05:46 (UTC)

Required by (16)

Sources (1)

Latest Comments

nicolasyang commented on 2024-07-08 19:03 (UTC)

@sctyboy Display is a Singleton. I think this stops patching subprocess.Popen from working when the unit tests run in batch. I have commented in the upstream issue.

sctyboy commented on 2024-07-08 13:24 (UTC) (edited on 2024-07-08 13:25 (UTC) by sctyboy)

I have the same build/test failure with cowsay, now, but only if it's run via makepkg, if I run the test manually it seems to pass fine:

from makepkg:

=================================== FAILURES ===================================
_____________________ test_display_with_fake_cowsay_binary _____________________
[gw8] linux -- Python 3.12.4 /usr/bin/python

capsys = <_pytest.capture.CaptureFixture object at 0x781d930b5640>
mocker = <pytest_mock.plugin.MockerFixture object at 0x781d930b5850>

    def test_display_with_fake_cowsay_binary(capsys, mocker):

        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")
E       AssertionError: assert not True
E        +  where True = hasattr(<ansible.utils.display.Display object at 0x781d9a01d790>, 'cows_available')

test/units/utils/display/test_broken_cowsay.py:22: AssertionError

manually:


[ssilverman@scottlinux ansible-core-2.16]$ pytest -r a -n auto --color yes -p no:cacheprovider -c ~/build/ansible-core-2.16/src/ansible-2.16.8/test/lib/ansible_test/_data/pytest/config/default.ini --junit-xml src/ansible-2.16.8/test/results/junit/python3.12-controller-units.xml --strict-markers --rootdir src/ansible-2.16.8 --confcutdir src/ansible-2.16.8 --durations=25 src/ansible-2.16.8/test/units/utils/display/test_broken_cowsay.py -vvv
============================================================================================================================= test session starts =============================================================================================================================
platform linux -- Python 3.12.4, pytest-8.2.2, pluggy-1.5.0 -- /usr/bin/python
rootdir: /home/ssilverman/build/ansible-core-2.16/src/ansible-2.16.8
configfile: test/lib/ansible_test/_data/pytest/config/default.ini
plugins: mock-3.14.0, xdist-3.5.0, forked-1.6.0, typeguard-4.3.0
20 workers [1 item]
scheduling tests via LoadScheduling

src/ansible-2.16.8/test/units/utils/display/test_broken_cowsay.py::test_display_with_fake_cowsay_binary
[gw0] [100%] PASSED src/ansible-2.16.8/test/units/utils/display/test_broken_cowsay.py::test_display_with_fake_cowsay_binary

--------------------------------------------------------------------- generated xml file: /home/ssilverman/build/ansible-core-2.16/src/ansible-2.16.8/test/results/junit/python3.12-controller-units.xml ----------------------------------------------------------------------
============================================================================================================================ slowest 25 durations =============================================================================================================================
0.00s setup    test/units/utils/display/test_broken_cowsay.py::test_display_with_fake_cowsay_binary
0.00s call     test/units/utils/display/test_broken_cowsay.py::test_display_with_fake_cowsay_binary
0.00s teardown test/units/utils/display/test_broken_cowsay.py::test_display_with_fake_cowsay_binary
============================================================================================================================== 1 passed in 0.91s ==============================================================================================================================
[ssilverman@scottlinux ansible-core-2.16]$ pytest src/ansible-2.16.8/test/units/utils/display/test_broken_cowsay.py -vvv
============================================================================================================================= test session starts =============================================================================================================================
platform linux -- Python 3.12.4, pytest-8.2.2, pluggy-1.5.0 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /home/ssilverman/build/ansible-core-2.16/src/ansible-2.16.8
configfile: pyproject.toml
plugins: mock-3.14.0, xdist-3.5.0, forked-1.6.0, typeguard-4.3.0
collected 1 item

src/ansible-2.16.8/test/units/utils/display/test_broken_cowsay.py::test_display_with_fake_cowsay_binary PASSED                                                                                                                                                          [100%]

============================================================================================================================== 1 passed in 0.06s ==============================================================================================================================

sctyboy commented on 2024-06-03 14:15 (UTC)

Upstream corrected this under https://github.com/ansible/ansible/pull/83347.

nicolasyang commented on 2024-05-30 03:18 (UTC) (edited on 2024-05-30 03:19 (UTC) by nicolasyang)

(In reply to @sctyboy)

If cowsay package is installed, then the build/tests fail as follows.

It is an upstream problem. The test also fails in 2.17.0 if cowsay is installed. Please report it to https://github.com/ansible/ansible.

sctyboy commented on 2024-05-29 19:17 (UTC) (edited on 2024-05-29 19:18 (UTC) by sctyboy)

If cowsay package is installed, then the build/tests fail as follows. Removing the cowsay package allows the build to proceed normally.


=================================== FAILURES ===================================
_____________________ test_display_with_fake_cowsay_binary _____________________
[gw13] linux -- Python 3.12.3 /usr/bin/python

capsys = <_pytest.capture.CaptureFixture object at 0x75e7f5486840>
mocker = <pytest_mock.plugin.MockerFixture object at 0x75e7f5485f70>

    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)

>       assert not hasattr(display, "cows_available")
E       AssertionError: assert not True
E        +  where True = hasattr(<ansible.utils.display.Display object at 0x75e7f7fb16a0>, 'cows_available')

test/units/utils/display/test_broken_cowsay.py:23: AssertionError