From 59ba2a4e671a199b26a50bc00d278fd2e2bc77dcf508f6d337d8e094aa08ab24 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Thu, 24 Mar 2022 04:46:20 +0000 Subject: [PATCH] - 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 --- pr_10.patch | 41 +++++++++++++++++++++++++++++++++++++ python-before-after.changes | 7 +++++++ python-before-after.spec | 8 +++----- 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 pr_10.patch diff --git a/pr_10.patch b/pr_10.patch new file mode 100644 index 0000000..381bb31 --- /dev/null +++ b/pr_10.patch @@ -0,0 +1,41 @@ +From 11c0ecc7e8a2f90a762831e216c1bc40abfda43a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +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"'], + ) diff --git a/python-before-after.changes b/python-before-after.changes index df1e18c..e003a03 100644 --- a/python-before-after.changes +++ b/python-before-after.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Mar 24 04:44:38 UTC 2022 - Steve Kowalik + +- Add pr_10.patch: + * Use stdlib unittest.mock. +- Drop {Build,}Requires on mock. + ------------------------------------------------------------------- Tue Sep 8 07:06:31 UTC 2020 - Tomáš Chvátal diff --git a/python-before-after.spec b/python-before-after.spec index 12efdc7..a021d9a 100644 --- a/python-before-after.spec +++ b/python-before-after.spec @@ -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