diff --git a/tests/unit/test_package_managers.py b/tests/unit/test_package_managers.py index 752d89bc1f..74c748da62 100644 --- a/tests/unit/test_package_managers.py +++ b/tests/unit/test_package_managers.py @@ -781,7 +781,7 @@ def test_install_dont_check_first( def _parametrize_test_reinstall() -> Iterator[tuple[ - Container, PackageManagerClass, Optional[str], Optional[str], Optional[str]]]: + Container, PackageManagerClass, Optional[str], Optional[str]]]: for container, package_manager_class in CONTAINER_BASE_MATRIX: if package_manager_class is tmt.package_managers.dnf.Yum: @@ -791,8 +791,7 @@ def _parametrize_test_reinstall() -> Iterator[tuple[ Package('tar'), \ True, \ r"rpm -q --whatprovides tar && yum reinstall -y tar && rpm -q --whatprovides tar", \ - 'Reinstalling:\n tar', \ - None # noqa: E501 + 'Reinstalling:\n tar' # noqa: E501 else: yield container, \ @@ -800,8 +799,7 @@ def _parametrize_test_reinstall() -> Iterator[tuple[ Package('tar'), \ True, \ r"rpm -q --whatprovides tar && yum reinstall -y tar && rpm -q --whatprovides tar", \ - 'Reinstalled:\n tar', \ - None # noqa: E501 + 'Reinstalled:\n tar' # noqa: E501 elif package_manager_class is tmt.package_managers.dnf.Dnf: yield container, \ @@ -809,8 +807,7 @@ def _parametrize_test_reinstall() -> Iterator[tuple[ Package('tar'), \ True, \ r"rpm -q --whatprovides tar && dnf reinstall -y tar", \ - 'Reinstalled:\n tar', \ - None + 'Reinstalled:\n tar' elif package_manager_class is tmt.package_managers.dnf.Dnf5: yield container, \ @@ -818,8 +815,7 @@ def _parametrize_test_reinstall() -> Iterator[tuple[ Package('tar'), \ True, \ r"rpm -q --whatprovides tar && dnf5 reinstall -y tar", \ - 'Reinstalling tar', \ - None + 'Reinstalling tar' elif package_manager_class is tmt.package_managers.apt.Apt: yield container, \ @@ -827,8 +823,7 @@ def _parametrize_test_reinstall() -> Iterator[tuple[ Package('tar'), \ True, \ r"export DEBIAN_FRONTEND=noninteractive; dpkg-query --show tar && apt reinstall -y tar", \ - 'Setting up tar', \ - None # noqa: E501 + 'Setting up tar' # noqa: E501 elif package_manager_class is tmt.package_managers.rpm_ostree.RpmOstree: yield container, \ @@ -836,7 +831,6 @@ def _parametrize_test_reinstall() -> Iterator[tuple[ Package('tar'), \ False, \ None, \ - None, \ None elif package_manager_class is tmt.package_managers.apk.Apk: @@ -845,8 +839,7 @@ def _parametrize_test_reinstall() -> Iterator[tuple[ Package('bash'), \ True, \ r"apk info -e bash && apk fix bash", \ - 'Reinstalling bash', \ - None + 'Reinstalling bash' else: pytest.fail(f"Unhandled package manager class '{package_manager_class}'.") @@ -858,8 +851,7 @@ def _parametrize_test_reinstall() -> Iterator[tuple[ 'package', 'supported', 'expected_command', - 'expected_stdout', - 'expected_stderr'), + 'expected_output'), list(_parametrize_test_reinstall()), indirect=["container_per_test"], ids=CONTAINER_MATRIX_IDS) @@ -870,8 +862,7 @@ def test_reinstall( package: Package, supported: bool, expected_command: Optional[str], - expected_stdout: Optional[str], - expected_stderr: Optional[str], + expected_output: Optional[str], root_logger: tmt.log.Logger, caplog: _pytest.logging.LogCaptureFixture) -> None: package_manager = create_package_manager( @@ -895,13 +886,9 @@ def test_reinstall( assert excinfo.value.message \ == "rpm-ostree does not support reinstall operation." - if expected_stdout: - assert output.stdout is not None - assert expected_stdout in output.stdout - - if expected_stderr: - assert output.stderr is not None - assert expected_stderr in output.stderr + if expected_output: + assert output.stdout is not None or output.stderr is not None + assert expected_output in output.stdout or expected_output in output.stderr def _generate_test_reinstall_nonexistent_matrix() -> Iterator[tuple[