14
0

- Add remove_double_patch.patch and remove_safe_hasattr.patch to

fix https://pagure.io/python-daemon/issue/53
- Remove pytest as the test runner (apparently, the package
  requires python3 -munittest discovery).

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-daemon?expand=0&rev=32
This commit is contained in:
2022-01-13 12:32:18 +00:00
committed by Git OBS Bridge
parent 3a486f8d92
commit fb00d6254d
4 changed files with 80 additions and 8 deletions

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Jan 13 12:30:48 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add remove_double_patch.patch and remove_safe_hasattr.patch to
fix https://pagure.io/python-daemon/issue/53
- Remove pytest as the test runner (apparently, the package
requires python3 -munittest discovery).
-------------------------------------------------------------------
Thu Apr 22 19:48:54 UTC 2021 - Dirk Müller <dmueller@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-python-daemon
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -26,10 +26,14 @@ License: Apache-2.0 AND GPL-3.0-only
Group: Development/Languages/Python
URL: https://pagure.io/python-daemon/
Source: https://files.pythonhosted.org/packages/source/p/python-daemon/python-daemon-%{version}.tar.gz
# PATCH-FIX-UPSTREAM remove_safe_hasattr.patch https://pagure.io/python-daemon/issue/53 mcepl@suse.com
# testtools.helpers.safe_hasattr has been removed and should never be mentioned again
Patch0: remove_safe_hasattr.patch
# PATCH-FIX-UPSTREAM remove_double_patch.patch https://pagure.io/python-daemon/issue/62 mcepl@suse.com
# some objects were mocked twice
Patch1: remove_double_patch.patch
BuildRequires: %{python_module docutils}
BuildRequires: %{python_module lockfile >= 0.10}
BuildRequires: %{python_module mock >= 1.3}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module testscenarios >= 0.4}
BuildRequires: %{python_module testtools}
@@ -49,7 +53,8 @@ same for every daemon program. A DaemonContext instance holds the behaviour and
process environment for the program; use the instance as a context manager to enter a daemon state.
%prep
%setup -q -n python-daemon-%{version}
%autosetup -p1 -n python-daemon-%{version}
sed -i '/docutils/d' setup.py
%build
@@ -60,10 +65,7 @@ sed -i '/docutils/d' setup.py
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# test_returns_standard_stream_file_descriptors fails
# test_returns_expected_result fails with distutils error
# Test suite is completely broken, https://pagure.io/python-daemon/issue/53
%python_exec -m pytest -k 'not test_returns_standard_stream_file_descriptors and not test_returns_expected_result' || /bin/true
%pyunittest discover -v
%files %{python_files}
%license LICENSE.ASF-2 LICENSE.GPL-3

47
remove_double_patch.patch Normal file
View File

@@ -0,0 +1,47 @@
From 0c67a3c6407fbf4483ccfc94a7a0d78cf3379296 Mon Sep 17 00:00:00 2001
From: Miro Hrončok <miro@hroncok.cz>
Date: Sep 29 2021 10:05:27 +0000
Subject: Remove incorrect double-patch of objects in test cases.
The specific test cases relying on the patches, already are decorated
to patch the specific attributes needed. We don't need a general patch
of the attributes in the test case setup.
Signed-off-by: Ben Finney <ben+python@benfinney.id.au>
---
---
ChangeLog | 4 ++++
test/test_pidfile.py | 6 ------
2 files changed, 4 insertions(+), 6 deletions(-)
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,10 @@ Version 2.3.0
:Released: 2021-02-21
:Maintainer: Ben Finney <ben+python@benfinney.id.au>
+* Remove incorrect double-patch of objects in test cases.
+
+ Closes: Pagure #62. Thanks to Miro Hrončok for the report.
+
Removed:
* Remove support for Python versions older than Python 3.
--- a/test/test_pidfile.py
+++ b/test/test_pidfile.py
@@ -391,12 +391,6 @@ class TimeoutPIDLockFile_TestCase(scaffo
pidlockfile_scenarios = make_pidlockfile_scenarios()
self.pidlockfile_scenario = pidlockfile_scenarios['simple']
- for func_name in ['__init__', 'acquire']:
- func_patcher = unittest.mock.patch.object(
- lockfile.pidlockfile.PIDLockFile, func_name)
- func_patcher.start()
- self.addCleanup(func_patcher.stop)
-
self.scenario = {
'pidfile_path': self.pidlockfile_scenario['pidfile_path'],
'acquire_timeout': self.getUniqueInteger(),

15
remove_safe_hasattr.patch Normal file
View File

@@ -0,0 +1,15 @@
---
test/test_metadata.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/test/test_metadata.py
+++ b/test/test_metadata.py
@@ -44,7 +44,7 @@ class HasAttribute(testtools.matchers.Ma
def match(self, instance):
""" Assert the object `instance` has an attribute named `name`. """
result = None
- if not testtools.helpers.safe_hasattr(instance, self.attribute_name):
+ if not hasattr(instance, self.attribute_name):
result = AttributeNotFoundMismatch(instance, self.attribute_name)
return result