mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-17 13:23:12 +00:00
xbps: include `stdout` and `stderr` in module output (#12234)
* fix(xbps): add stdout/stderr to module output and fix error message typo
Include stdout and stderr from the last executed command in all
exit_json and fail_json calls so users can see the actual xbps output
when debugging failures (addresses issue #2478).
* test(xbps): add basic unit tests using uthelper
Cover install (new, already present, failure) and remove (installed,
absent) scenarios. Verifies stdout/stderr are propagated in output.
* changelog: add fragment for PR 12234
* Add version_added.
---------
(cherry picked from commit 7dc2441fc8)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
19 lines
571 B
Python
19 lines
571 B
Python
# Copyright (c) 2025, Alexei Znamensky <russoz@gmail.com>
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from ansible_collections.community.general.plugins.modules import xbps
|
|
|
|
from .uthelper import RunCommandMock, UTHelper
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def patch_os_path_exists(mocker):
|
|
mocker.patch("os.path.exists", return_value=True)
|
|
|
|
|
|
UTHelper.from_module(xbps, __name__, mocks=[RunCommandMock])
|