- Replace python-deprecation-no-unittest2.patch with a different upstream
patch. - Switch to autosetup and pyproject macros. - No more greedy globs in %files. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-deprecation?expand=0&rev=17
This commit is contained in:
parent
7d7162a268
commit
4441069f97
@ -1,41 +1,30 @@
|
||||
Index: deprecation-2.1.0/tests/test_deprecation.py
|
||||
===================================================================
|
||||
--- deprecation-2.1.0.orig/tests/test_deprecation.py 2020-04-20 16:14:19.000000000 +0200
|
||||
+++ deprecation-2.1.0/tests/test_deprecation.py 2020-06-01 13:51:55.484939683 +0200
|
||||
@@ -12,14 +12,16 @@
|
||||
From e13e23068cb8d653a02a434a159e8b0b7226ffd6 Mon Sep 17 00:00:00 2001
|
||||
From: Jonathan Ringer <jonringer117@gmail.com>
|
||||
Date: Tue, 11 Jan 2022 14:23:03 -0800
|
||||
Subject: [PATCH] Make unittest optional for python3.5+
|
||||
|
||||
---
|
||||
docs-requirements.txt | 2 +-
|
||||
test-requirements.txt | 2 +-
|
||||
tests/test_deprecation.py | 7 ++++++-
|
||||
tox.ini | 2 +-
|
||||
4 files changed, 9 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tests/test_deprecation.py b/tests/test_deprecation.py
|
||||
index 0fd29b3..14e9510 100644
|
||||
--- a/tests/test_deprecation.py
|
||||
+++ b/tests/test_deprecation.py
|
||||
@@ -12,7 +12,12 @@
|
||||
|
||||
# As we unfortunately support Python 2.7, it lacks TestCase.subTest which
|
||||
# is in 3.4+ or in unittest2
|
||||
-import unittest2
|
||||
+import unittest
|
||||
+if not hasattr(unittest.TestCase, "subTest"):
|
||||
+ import unittest2 as unittest
|
||||
+try:
|
||||
+ import unittest2
|
||||
+except ImportError:
|
||||
+ import unittest
|
||||
+ unittest2 = unittest
|
||||
+
|
||||
import warnings
|
||||
|
||||
import deprecation
|
||||
from datetime import date
|
||||
|
||||
|
||||
-class Test_deprecated(unittest2.TestCase):
|
||||
+class Test_deprecated(unittest.TestCase):
|
||||
|
||||
def test_args_set_on_base_class(self):
|
||||
args = (1, 2, 3, 4)
|
||||
@@ -230,7 +232,7 @@ class Test_deprecated(unittest2.TestCase
|
||||
self.assertEqual(sot.method(), ret_val)
|
||||
|
||||
|
||||
-class Test_fail_if_not_removed(unittest2.TestCase):
|
||||
+class Test_fail_if_not_removed(unittest.TestCase):
|
||||
|
||||
@deprecation.deprecated(deprecated_in="1.0", current_version="2.0")
|
||||
def _deprecated_method(self):
|
||||
@@ -259,7 +261,7 @@ class Test_fail_if_not_removed(unittest2
|
||||
except AssertionError:
|
||||
self.fail("A DeprecatedWarning shouldn't cause a failure")
|
||||
|
||||
- @unittest2.expectedFailure
|
||||
+ @unittest.expectedFailure
|
||||
@deprecation.fail_if_not_removed
|
||||
def test_literal_UnsupportedWarning(self):
|
||||
self._unsupported_method()
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 27 03:49:53 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Replace python-deprecation-no-unittest2.patch with a different upstream
|
||||
patch.
|
||||
- Switch to autosetup and pyproject macros.
|
||||
- No more greedy globs in %files.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 10 16:42:46 CET 2023 - marec@detebe.org
|
||||
- update python build instruction
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-deprecation
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,26 +17,24 @@
|
||||
|
||||
|
||||
%{?sle15_python_module_pythons}
|
||||
%bcond_without python2
|
||||
Name: python-deprecation
|
||||
Version: 2.1.0
|
||||
Release: 0
|
||||
Summary: A library to handle automated deprecations
|
||||
License: Apache-2.0
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/briancurtin/deprecation
|
||||
Source: https://files.pythonhosted.org/packages/source/d/deprecation/deprecation-%{version}.tar.gz
|
||||
# https://github.com/briancurtin/deprecation/pull/50
|
||||
# PATCH-FIX-UPSTREAM Based on gh#briancurtin/deprecation#57
|
||||
Patch0: python-deprecation-no-unittest2.patch
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module wheel}
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module pytest}
|
||||
%if %{with python2}
|
||||
BuildRequires: python-unittest2
|
||||
%endif
|
||||
# /SECTION
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-packaging
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
@ -46,15 +44,13 @@ The `deprecation` library provides a `deprecated` decorator and a
|
||||
enable the automation of several things:
|
||||
|
||||
%prep
|
||||
%setup -q -n deprecation-%{version}
|
||||
%patch0 -p1
|
||||
%autosetup -p1 -n deprecation-%{version}
|
||||
|
||||
%build
|
||||
|
||||
%python_build
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
%python_install
|
||||
%pyproject_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
@ -63,6 +59,8 @@ enable the automation of several things:
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
%doc README.rst
|
||||
%{python_sitelib}/*
|
||||
%{python_sitelib}/deprecation.py
|
||||
%pycache_only %{python_sitelib}/__pycache__/deprecation.*.py*
|
||||
%{python_sitelib}/deprecation-%{version}.dist-info
|
||||
|
||||
%changelog
|
||||
|
Loading…
x
Reference in New Issue
Block a user