# Ansible-test units is failing in github actions now

**URL:** <https://forum.ansible.com/t/ansible-test-units-is-failing-in-github-actions-now/41726>\
**Category:** Get Help\
**Created:** [April 14, 2025, 6:07pm UTC](https://forum.ansible.com/t/ansible-test-units-is-failing-in-github-actions-now/41726 "2025-04-14T18:07:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![opoplawski](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/opoplawski/32/2112_2.png) [@opoplawski](https://forum.ansible.com/u/opoplawski)\
**Post date:** [April 14, 2025, 6:07pm UTC](https://forum.ansible.com/t/ansible-test-units-is-failing-in-github-actions-now/41726/1 "2025-04-14T18:07:01Z")

</div>

I’m the author of the pfsensible.core collection. My ansible unit tests are now failing in github actions with:

```auto
[gw2] linux -- Python 3.10.16 /opt/hostedtoolcache/Python/3.10.16/x64/bin/python

self = <ansible_collections.pfsensible.core.tests.unit.plugins.modules.test_pfsense_vlan.TestPFSenseVlanModule testMethod=test_vlan_delete_unexistent>

    def test_vlan_delete_unexistent(self):
        """ test deletion of a vlan """
        vlan = dict(vlan_id=1200, interface='vmx1')
> self.do_module_test(vlan, delete=True, changed=False)

tests/unit/plugins/modules/test_pfsense_vlan.py:122: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/unit/plugins/modules/pfsense_module.py:171: in do_module_test
    result = self.execute_module(changed=changed, failed=failed, msg=msg)
tests/unit/plugins/modules/pfsense_module.py:144: in execute_module
    result = self.changed(changed)
tests/unit/plugins/modules/pfsense_module.py:203: in changed
    self.module.main()
plugins/modules/pfsense_vlan.py:77: in main
    module = AnsibleModule(
/tmp/ansible-test-_yh7xkcf/ansible/module_utils/basic.py:416: in __init__
    self._load_params()
/tmp/ansible-test-_yh7xkcf/ansible/module_utils/basic.py:1214: in _load_params
    self.params = _load_params()
/tmp/ansible-test-_yh7xkcf/ansible/module_utils/basic.py:326: in _load_params
    buffer = sys.stdin.buffer.read()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def read(self, size: int = -1) -> str:
> raise OSError(
            "pytest: reading from stdin while output is captured! Consider using `-s`."
        )
E OSError: pytest: reading from stdin while output is captured! Consider using `-s`.

/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/_pytest/capture.py:227: OSError

```

I’ve tried adding this to setup.cfg:

```auto
[tool:pytest]
addopts = -s

```

to no avail.

See [Workflow runs · pfsensible/core · GitHub](https://github.com/pfsensible/core/actions)

Any suggestions would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [April 14, 2025, 6:54pm UTC](https://forum.ansible.com/t/ansible-test-units-is-failing-in-github-actions-now/41726/2 "2025-04-14T18:54:39Z")

</div>

Check out [Making a collection compatible with data tagging - #2 by felixfontein](https://forum.ansible.com/t/41717/2), that’s very likely what makes your test fail.

---

<div class="post-metadata">

**Author:** ![opoplawski](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/opoplawski/32/2112_2.png) [@opoplawski](https://forum.ansible.com/u/opoplawski)\
**Post date:** [April 14, 2025, 7:01pm UTC](https://forum.ansible.com/t/ansible-test-units-is-failing-in-github-actions-now/41726/3 "2025-04-14T19:01:03Z")

</div>

Really? I’m only testing with core 2.14-2.17. Also, currently using:

```auto
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import set_module_args

```

and not mucking with \_ANSIBLE\_ARGS.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [April 14, 2025, 7:21pm UTC](https://forum.ansible.com/t/ansible-test-units-is-failing-in-github-actions-now/41726/4 "2025-04-14T19:21:52Z")

</div>

Could this be related to utilizing `community.internal_test_tools` but not pinning the version to use?

I’ve never used that collection, but maybe a change to `ModuleTestCase‎` has caused it. And without pinning the version of that collection, if behavior changed, it could cause your tests to break.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [April 14, 2025, 7:43pm UTC](https://forum.ansible.com/t/ansible-test-units-is-failing-in-github-actions-now/41726/5 "2025-04-14T19:43:32Z")

</div>

It _is_ related to community.internal\_test\_tools 0.15.0, which has a breaking change, see the changelog: [community.internal\_test\_tools/CHANGELOG.md at main · ansible-collections/community.internal\_test\_tools · GitHub](https://github.com/ansible-collections/community.internal_test_tools/blob/main/CHANGELOG.md#v0-15-0)

Basically CI has been broken for three weeks (since 0.15.0 has been released), but since nothing ran in [Workflow runs · pfsensible/core · GitHub](https://github.com/pfsensible/core/actions) since then it was kind of invisible 🙂

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [April 14, 2025, 7:45pm UTC](https://forum.ansible.com/t/ansible-test-units-is-failing-in-github-actions-now/41726/6 "2025-04-14T19:45:32Z")

</div>

(0.16.0 should be out soon with DT support, once I figure out why the codecov uploader is suddenly failing…)

(Update: 0.16.0 is out by now.)

---

<div class="post-metadata">

**Author:** ![opoplawski](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/opoplawski/32/2112_2.png) [@opoplawski](https://forum.ansible.com/u/opoplawski)\
**Post date:** [April 14, 2025, 8:28pm UTC](https://forum.ansible.com/t/ansible-test-units-is-failing-in-github-actions-now/41726/7 "2025-04-14T20:28:37Z")

</div>

Switching to `with set_module_args(args):` did the trick. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [May 14, 2025, 8:29pm UTC](https://forum.ansible.com/t/ansible-test-units-is-failing-in-github-actions-now/41726/8 "2025-05-14T20:29:11Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
