15
0

- Add pr_10.patch:

* Use stdlib unittest.mock.
- Drop {Build,}Requires on mock.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-before-after?expand=0&rev=4
This commit is contained in:
2022-03-24 04:46:20 +00:00
committed by Git OBS Bridge
parent 61cbbdf028
commit 59ba2a4e67
3 changed files with 51 additions and 5 deletions

41
pr_10.patch Normal file
View File

@@ -0,0 +1,41 @@
From 11c0ecc7e8a2f90a762831e216c1bc40abfda43a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Mon, 10 May 2021 22:01:00 +0200
Subject: [PATCH] Use built-in unittest.mock in Python 3.3+
---
before_after/__init__.py | 5 ++++-
setup.py | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/before_after/__init__.py b/before_after/__init__.py
index 1081684..e713a61 100644
--- a/before_after/__init__.py
+++ b/before_after/__init__.py
@@ -50,7 +50,10 @@ def inner(*a, **k):
return ret
return inner
- from mock import patch
+ if sys.version_info >= (3, 3):
+ from unittest.mock import patch
+ else:
+ from mock import patch
patcher = patch(target, **kwargs)
original, _ = patcher.get_original()
diff --git a/setup.py b/setup.py
index 572470c..b1167df 100644
--- a/setup.py
+++ b/setup.py
@@ -31,8 +31,9 @@
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
],
keywords=['testing', 'race conditions'],
- install_requires=['mock>=1.0.1'],
+ install_requires=['mock>=1.0.1; python_version < "3.3"'],
)

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Mar 24 04:44:38 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Add pr_10.patch:
* Use stdlib unittest.mock.
- Drop {Build,}Requires on mock.
-------------------------------------------------------------------
Tue Sep 8 07:06:31 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-before-after
#
# Copyright (c) 2020 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
@@ -27,13 +27,12 @@ Source: https://files.pythonhosted.org/packages/source/b/before_after/be
# https://github.com/c-oreills/before_after/issues/8
Source1: https://raw.githubusercontent.com/c-oreills/before_after/master/LICENSE
Patch0: https://patch-diff.githubusercontent.com/raw/c-oreills/before_after/pull/6.patch#/pr_6.patch
Patch1: https://patch-diff.githubusercontent.com/raw/c-oreills/before_after/pull/10.patch#/pr_10.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-mock >= 1.0.1
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module mock >= 1.0.1}
BuildRequires: %{python_module pytest}
# /SECTION
%python_subpackages
@@ -42,8 +41,7 @@ BuildRequires: %{python_module pytest}
before_after provides utilities for testing race conditions.
%prep
%setup -q -n before_after-%{version}
%patch0 -p1
%autosetup -p1 -n before_after-%{version}
cp %{SOURCE1} .
%build