From 2591a5a276164e2e4534f5b364a28d9d20e0cf52 Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: Apr 05 2022 19:12:44 +0000 Subject: Adjust spec to build on EPEL 9 Drop unused deprecated python3-mock test dependency Switch test runner to pytest Signed-off-by: Michel Alexandre Salim --- diff --git a/dcrpm-mock_pid.patch b/dcrpm-mock_pid.patch new file mode 100644 index 0000000..ebbc46c --- /dev/null +++ b/dcrpm-mock_pid.patch @@ -0,0 +1,12 @@ +diff '--color=auto' -ruN dcrpm-0.6.2/tests/test_util.py dcrpm-0.6.2-mock_pid/tests/test_util.py +--- dcrpm-0.6.2/tests/test_util.py 2020-03-25 15:13:09.000000000 -0700 ++++ dcrpm-0.6.2-mock_pid/tests/test_util.py 2022-04-05 12:11:49.228422082 -0700 +@@ -45,7 +45,7 @@ + Creates a simple mocked Popen object that responds to Popen.poll and + Popen.communicate. + """ +- mock_popen_obj = Mock() ++ mock_popen_obj = Mock(pid=42) + config = {"poll.return_value": returncode} # type: t.Dict[str, t.Any] + if communicate_raise: + config["communicate.side_effect"] = TimeoutExpired() diff --git a/python-dcrpm.spec b/python-dcrpm.spec index 9131b7f..c612bb7 100644 --- a/python-dcrpm.spec +++ b/python-dcrpm.spec @@ -1,11 +1,23 @@ -%bcond_without tests +%if 0%{?rhel} +%if 0%{?el9} +# Skip tests on EL9 due to missing dependencies +%bcond_with check +%else +%bcond_without check +%endif +# pypandoc is an optional dependency and is not available in EPEL +%bcond_with doc +%else +%bcond_without check +%bcond_without doc +%endif # Created by pyp2rpm-3.3.5 %global pypi_name dcrpm Name: python-%{pypi_name} Version: 0.6.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: A tool to detect and correct common issues around RPM database corruption License: GPLv2 @@ -17,26 +29,29 @@ Patch0: %{url}/commit/efc0166793db58e08b57ba3839638f7571355b93.patch Patch1: %{url}/commit/f7f89146e37c009a164e0e81de9b6b23d4874ffc.patch # tests: properly mock yum process name Patch2: %{url}/commit/efcc4337821b3e498d832d2b6bf4241716acc0b3.patch +# make_mock_popen: also mock pid - from %%{url}/pull/48 +Patch3: %{pypi_name}-mock_pid.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3dist(psutil) BuildRequires: python3dist(setuptools) -%if 0%{?el8} -# pypandoc is an optional dependency and is not available in EPEL 8 -%else -BuildRequires: python3dist(pypandoc) -%endif -%if %{with tests} -BuildRequires: python3dist(mock) +%if %{with check} +BuildRequires: python3dist(pytest) BuildRequires: python3dist(testslide) BuildRequires: dnf BuildRequires: libdb-utils %endif +%if %{with doc} +BuildRequires: python3dist(pypandoc) +%endif -%description +%global _description %{expand: dcrpm is a tool to detect and correct common issues around RPM database -corruption. +corruption.} + +%description %{_description} + %package -n %{pypi_name} Summary: %{summary} @@ -48,9 +63,9 @@ Requires: python3dist(psutil) Requires: python3dist(setuptools) Requires: lsof Recommends: libdb-utils -%description -n %{pypi_name} -dcrpm is a tool to detect and correct common issues around RPM database -corruption. + +%description -n %{pypi_name} %{_description} + %prep %autosetup -n %{pypi_name}-%{version} -p1 @@ -59,17 +74,22 @@ sed -e '\|#!/usr/bin/env python|d' -i dcrpm/*.py # Remove bundled egg-info rm -rf %{pypi_name}.egg-info + %build %py3_build + %install %py3_install -%if %{with tests} + %check -%{__python3} setup.py test +%py3_check_import %{pypi_name} +%if %{with check} +%pytest -v %endif + %files -n %{pypi_name} %license LICENSE %doc README.md CONTRIBUTING.md CODE_OF_CONDUCT.md @@ -78,7 +98,13 @@ rm -rf %{pypi_name}.egg-info %{python3_sitelib}/%{pypi_name} %{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info + %changelog +* Tue Apr 05 2022 Michel Alexandre Salim - 0.6.2-8 +- Adjust spec to build on EPEL 9 +- Drop unused deprecated python3-mock test dependency +- Switch test runner to pytest + * Fri Jan 21 2022 Fedora Release Engineering - 0.6.2-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild