11
0

- Add missing BuildRequires on setuptools.

- Add patch remove-external-mock.patch:
  * Remove requirement on external mock module.
- Do not run testsuite with pytest, we already do so with unittest.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-parameterized?expand=0&rev=42
This commit is contained in:
2025-07-10 02:31:39 +00:00
committed by Git OBS Bridge
commit 6137f15ca8
10 changed files with 517 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

24
fix-assert-method.patch Normal file
View File

@@ -0,0 +1,24 @@
From d64843df5f339f486a9b29d492f2988a3bf8485b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= <tomas.hrnciar@me.com>
Date: Tue, 2 May 2023 13:48:00 +0200
Subject: [PATCH] Remove the usage of assertRaisesRegexp unit test alias
removed in Python 3.12
https://bugs.python.org/issue?@action=redirect&bpo=45162
---
parameterized/test.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parameterized/test.py b/parameterized/test.py
index 6c71f79..498c591 100644
--- a/parameterized/test.py
+++ b/parameterized/test.py
@@ -35,7 +35,7 @@ def assert_raises_regexp_decorator(expected_exception, expected_regexp):
def func_decorator(func):
@wraps(func)
def wrapper(self, *args, **kwargs):
- with self.assertRaisesRegexp(expected_exception, expected_regexp):
+ with self.assertRaisesRegex(expected_exception, expected_regexp):
func(self, *args, **kwargs)
return wrapper

View File

@@ -0,0 +1,41 @@
From b08a1f287d379d13fe51239712a4d570bd0c556d Mon Sep 17 00:00:00 2001
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
Date: Mon, 30 Oct 2023 10:38:27 -0400
Subject: [PATCH 1/2] Fix tests to handle Python 3.13 stripping indents from
docstrings
https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes
https://github.com/python/cpython/issues/81283
---
parameterized/test.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/parameterized/test.py b/parameterized/test.py
index 6c71f79..6419171 100644
--- a/parameterized/test.py
+++ b/parameterized/test.py
@@ -408,10 +408,16 @@ class TestParameterizedExpandDocstring(TestCase):
"""Documentation.
More"""
- self._assert_docstring(
- "Documentation [with foo=%r].\n\n"
- " More" %(foo, )
- )
+ if sys.version_info[:2] < (3, 13):
+ self._assert_docstring(
+ "Documentation [with foo=%r].\n\n"
+ " More" %(foo, )
+ )
+ else:
+ self._assert_docstring(
+ "Documentation [with foo=%r].\n\n"
+ "More" %(foo, )
+ )
@parameterized.expand([param("foo")])
def test_unicode_docstring(self, foo):
--
2.45.2

BIN
parameterized-0.9.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,169 @@
-------------------------------------------------------------------
Thu Jul 10 02:30:29 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Add missing BuildRequires on setuptools.
- Add patch remove-external-mock.patch:
* Remove requirement on external mock module.
- Do not run testsuite with pytest, we already do so with unittest.
-------------------------------------------------------------------
Mon Jul 22 11:26:38 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Cherry-pick upstream patch to fix tests with Python 3.13
* fix-tests-with-python3.13.patch
-------------------------------------------------------------------
Tue Aug 15 09:02:40 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch fix-assert-method.patch:
* Use correct assertion method.
-------------------------------------------------------------------
Fri May 12 09:54:40 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Update to 0.9.0:
- Drop support for Python 2.X, 3.5, and 3.6;
Add support for Python 3.10, 3.11
- Modernize from setup.py -> pyproject.toml
- Add ``namespace`` argument to ``@parameterize.expand``
- Add support for ``IsolatedAsyncioTestCase``
- Work around for bug bpo-40126 in older versions of ``mock``
- Allow str, bytes, and any non-iterable input to be passed to
``@parameterized`` without wrapping in a tuple
- Fix class-level ``mock.patch.multiple``
- Add skip_failing_teardown.patch (gh#wolever/parameterized#167)
to overcome failing tearDownModule().
- Remove upstreamed parameterized-pr116-pytest4.patch
-------------------------------------------------------------------
Fri Apr 21 12:28:56 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Thu Apr 13 22:42:52 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Make calling of %{sle15modernpython} optional.
-------------------------------------------------------------------
Fri Aug 19 18:54:32 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Disable testing with nose2
* nose2 is actively maintained, but not used much in the
distribution. No need to test it in Ring1.
-------------------------------------------------------------------
Thu Apr 14 17:07:13 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Add parameterized-pr116-pytest4.patch for pytest 4 to 7 (!)
support -- gh#wolever/parameterized#116
- Refresh remove_nose.patch
- Drop skip_Documentation_tests.patch fixed upstream
-------------------------------------------------------------------
Thu Apr 7 12:34:14 UTC 2022 - pgajdos@suse.com
- version update to 0.8.1
0.8.1 (2021-01-09)
* Add README and LICENSE to pypi sdist package
(https://github.com/wolever/parameterized/pull/114; thanks @chohner)
0.8.0 (2021-01-04)
* Handle camelCase test names. This is an ever-so-slightly backwards
incompatible change, as the method for determining which methods are
test methods has changed from ``method_name.startswith("test_")`` to
``method_name.startswith("test")``. The latter is the behavior of
the ``unittest`` module.
(thanks @bobwalker99; https://github.com/wolever/parameterized/pull/106)
* Fix arguments to skip_on_empty helper (thanks @bhavyakjain;
https://github.com/wolever/parameterized/pull/104)
0.7.5 (2021-01-04)
* Fix crash on Python 2.7 with unicode docstrings
(https://github.com/wolever/parameterized/issues/109)
* Replace inspect.stack() with faster inspect.currentframe()
(https://github.com/wolever/parameterized/issues/107)
* Add a __version__ string to the package
(https://github.com/wolever/parameterized/issues/103)
-------------------------------------------------------------------
Mon Sep 14 15:10:37 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Add remove_nose.patch to eliminate nose dependency. The patch
is not very good, it still skips plenty of yield tests (which
were ignored even before, so it is not even a regression).
-------------------------------------------------------------------
Fri Aug 14 03:29:41 UTC 2020 - John Vandenberg <jayvdb@gmail.com>
- Re-activate testing with pytest runner
-------------------------------------------------------------------
Tue Jun 2 14:26:24 UTC 2020 - pgajdos@suse.com
- version update to 0.7.4
* Add ``class_name_func`` option to ``@parameterized_class``
* Fix arguments being passed to skip_on_empty_helper (thanks @gaf3;
https://github.com/wolever/parameterized/issues/57)
* Fix tests on Python 3.8.2 (thanks @Ikke;
https://github.com/wolever/parameterized/pull/99)
* Fix some typos (thanks @LWprogramming, @jinnovation;
https://github.com/wolever/parameterized/pull/77,
https://github.com/wolever/parameterized/pull/80)
* Fix unicode handling in setup.py (thanks @sliwinski-milosz;
https://github.com/wolever/parameterized/pull/89)
* Fix Python 3.9 compat (thanks @vstinner;
https://github.com/wolever/parameterized/pull/94)
* Add `@parameterized_class` name function callback support (thanks
@duncwebb et al; https://github.com/wolever/parameterized/pull/74)
- drop dependency on unittest2
-------------------------------------------------------------------
Fri Dec 13 12:49:20 UTC 2019 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Include in SLE-15 (bsc#1159018, jsc#PM-1507)
-------------------------------------------------------------------
Thu Dec 5 15:52:40 CET 2019 - Matej Cepl <mcepl@suse.com>
- Update to 0.7.1:
- calling `setUp` and `tearDown` in parameterized classesq
- Add skip_Documentation_tests.patch to skip over test cases,
failing with Python 3.8. gh#wolever/parameterized#84
-------------------------------------------------------------------
Tue Nov 5 09:31:02 UTC 2019 - Ondřej Súkup <mimi.vx@gmail.com>
- remove pytest test, enable other test frameworks
-------------------------------------------------------------------
Wed Aug 21 14:41:30 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Use pytest 3.x series as newer use different syntax
-------------------------------------------------------------------
Fri Mar 15 13:34:56 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 0.7.0:
* Added parameterized_class feature, for parameterizing entire test
classes (many thanks to @TobyLL for their suggestions and help testing!)
* Fix DeprecationWarning on `inspect.getargs` (thanks @brettdh;
https://github.com/wolever/parameterized/issues/67)
* Make sure that `setUp` and `tearDown` methods work correctly (#40)
* Raise a ValueError when input is empty (thanks @danielbradburn;
https://github.com/wolever/parameterized/pull/48)
* Fix the order when number of cases exceeds 10 (thanks @ntflc;
https://github.com/wolever/parameterized/pull/49)
-------------------------------------------------------------------
Tue Dec 4 12:51:07 UTC 2018 - Matej Cepl <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
-------------------------------------------------------------------
Wed May 16 15:50:46 UTC 2018 - toddrme2178@gmail.com
- Use license tag
-------------------------------------------------------------------
Sun Oct 22 18:06:35 UTC 2017 - toddrme2178@gmail.com
- Initial version

87
python-parameterized.spec Normal file
View File

@@ -0,0 +1,87 @@
#
# spec file for package python-parameterized
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%bcond_with ringdisabled
%if %{with ringdisabled}
# nose2 is actively maintained, but not used much in the distribution. No need to test it in ring1
%bcond_with nose2
%else
%bcond_without nose2
%endif
%{?sle15_python_module_pythons}
Name: python-parameterized
Version: 0.9.0
Release: 0
Summary: Parameterized testing
License: BSD-2-Clause
URL: https://github.com/wolever/parameterized
Source: https://files.pythonhosted.org/packages/source/p/parameterized/parameterized-%{version}.tar.gz
# PATCH-FIX-OPENSUSE remove_nose.patch mcepl@suse.com
# Remove nose dependency (patch is not very good, DO NOT SEND UPSTREAM!)
Patch1: remove_nose.patch
# PATCH-FIX-UPSTREAM skip_failing_teardown.patch gh#wolever/parameterized#167 mcepl@suse.com
# skip failing assert in tearDownModule [sic]
Patch2: skip_failing_teardown.patch
# PATCH-FIX-UPSTREAM gh#wolever/parameterized#169
Patch3: fix-assert-method.patch
# PATCH-FIX-UPSTREAM gh#wolever/parameterized#176
Patch4: fix-tests-with-python3.13.patch
# PATCH-FIX-UPSTREAM Based on gh#wolever/parameterized#186
Patch5: remove-external-mock.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
%if %{with nose2}
BuildRequires: %{python_module nose2}
%endif
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
%python_subpackages
%description
Parameterized testing with any Python test framework.
%prep
%autosetup -p1 -n parameterized-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
export LANG=en_US.UTF8
%if %{with nose2}
%{python_expand nose2-%$python_version -v -B --pretty-assert}
%endif
%python_exec -m unittest parameterized.test
%files %{python_files}
%doc README.rst
# gh#wolever/parameterized#168
# %%doc CHANGELOG.txt
%license LICENSE.txt
%{python_sitelib}/parameterized
%{python_sitelib}/parameterized-%{version}.dist-info
%changelog

View File

@@ -0,0 +1,26 @@
From caa701915f1ef6a940d9589f91ff0853f930084f Mon Sep 17 00:00:00 2001
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
Date: Tue, 6 May 2025 10:02:24 -0400
Subject: [PATCH] Remove test dependency on PyPI mock
Use `unittest.mock` from the Python standard library instead.
---
parameterized/test.py | 3 +--
tox.ini | 1 -
2 files changed, 1 insertion(+), 3 deletions(-)
Index: parameterized-0.9.0/parameterized/test.py
===================================================================
--- parameterized-0.9.0.orig/parameterized/test.py
+++ parameterized-0.9.0/parameterized/test.py
@@ -2,9 +2,8 @@
import inspect
import sys
-import mock
from functools import wraps
-from unittest import TestCase
+from unittest import TestCase, mock
import pytest
from .parameterized import (

125
remove_nose.patch Normal file
View File

@@ -0,0 +1,125 @@
---
parameterized/parameterized.py | 2 +-
parameterized/test.py | 34 ++++++++++++++--------------------
2 files changed, 15 insertions(+), 21 deletions(-)
--- a/parameterized/parameterized.py
+++ b/parameterized/parameterized.py
@@ -342,7 +342,7 @@ def default_name_func(func, num, p):
_test_runner_override = None
_test_runner_guess = False
-_test_runners = set(["unittest", "unittest2", "nose", "nose2", "pytest"])
+_test_runners = set(["unittest", "unittest2", "nose2", "pytest"])
_test_runner_aliases = {
"_pytest": "pytest",
}
--- a/parameterized/test.py
+++ b/parameterized/test.py
@@ -5,13 +5,7 @@ import sys
import mock
from functools import wraps
from unittest import TestCase
-try:
- from nose.tools import assert_equal, assert_raises
-except ImportError:
- def assert_equal(*args, **kwds):
- return TestCase().assertEqual(*args, **kwds)
- def assert_raises(*args, **kwds):
- return TestCase().assertRaises(*args, **kwds)
+import pytest
from .parameterized import (
PY3, PY2, parameterized, param, parameterized_argument_value_pairs,
@@ -145,12 +139,12 @@ if not PYTEST:
self.actual_order = self.stack.pop(0)
def tearDown(self):
- missing_tests.remove("teardown_called(%s)" %(self.stack.pop(0), ))
+ missing_tests.remove("teardown_called(%s)" % (self.stack.pop(0), ))
@parameterized([(1, ), (2, )])
def test_setup(self, count, *a):
- assert_equal(self.actual_order, "setup %s" %(count, ))
- missing_tests.remove("test_setup(%s)" %(self.actual_order, ))
+ assert self.actual_order == "setup %s" % count
+ missing_tests.remove("test_setup(%s)" % self.actual_order)
def custom_naming_func(custom_tag):
@@ -361,9 +355,9 @@ class TestParamerizedOnTestCase(TestCase
frame_locals = frame[0].f_locals
nose_test_method_name = frame_locals['a'][0]._testMethodName
expected_name = "test_on_TestCase2_custom_name_" + parameterized.to_safe_name(foo)
- assert_equal(nose_test_method_name, expected_name,
- "Test Method name '%s' did not get customized to expected: '%s'" %
- (nose_test_method_name, expected_name))
+ assert nose_test_method_name == expected_name, \
+ "Test Method name '%s' did not get customized to expected: '%s'" % \
+ (nose_test_method_name, expected_name)
missing_tests.remove("%s(%r, bar=%r)" %(expected_name, foo, bar))
@@ -385,7 +379,7 @@ class TestParameterizedExpandDocstring(T
actual_docstring = test_method.__doc__
if rstrip:
actual_docstring = actual_docstring.rstrip()
- assert_equal(actual_docstring, expected_docstring)
+ assert actual_docstring == expected_docstring
@parameterized.expand([param("foo")],
doc_func=lambda f, n, p: "stuff")
@@ -453,7 +447,7 @@ def test_helpful_error_on_empty_iterable
def test_skip_test_on_empty_iterable():
func = parameterized([], skip_on_empty=True)(lambda: None)
- assert_raises(SkipTest, func)
+ pytest.raises(SkipTest, func)
def test_helpful_error_on_empty_iterable_input_expand():
@@ -486,7 +480,7 @@ def test_helpful_error_on_non_iterable_i
def tearDownModule():
missing = sorted(list(missing_tests))
- assert_equal(missing, [])
+ assert missing == []
def test_old_style_classes():
if PY3:
@@ -536,7 +530,7 @@ class TestOldStyleClass:
def test_parameterized_argument_value_pairs(func_params, p, expected):
helper = eval("lambda %s: None" %(func_params, ))
actual = parameterized_argument_value_pairs(helper, p)
- assert_equal(actual, expected)
+ assert actual == expected
@parameterized([
@@ -546,7 +540,7 @@ def test_parameterized_argument_value_pa
(123456789, "12...89", 4),
])
def test_short_repr(input, expected, n=6):
- assert_equal(short_repr(input, n=n), expected)
+ assert short_repr(input, n=n) == expected
@parameterized([
("foo", ),
@@ -560,7 +554,7 @@ cases_over_10 = [(i, i+1) for i in range
@parameterized(cases_over_10)
def test_cases_over_10(input, expected):
- assert_equal(input, expected-1)
+ assert input == expected-1
@parameterized_class(("a", "b", "c"), [
@@ -579,7 +573,7 @@ class TestParameterizedClass(TestCase):
def _assertions(self, test_name):
assert hasattr(self, "a")
- assert_equal(self.b + self.c, 3)
+ assert self.b + self.c == 3
missing_tests.remove("%s:%s(%r, %r, %r)" %(
self.__class__.__name__,
test_name,

View File

@@ -0,0 +1,18 @@
---
parameterized/test.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: parameterized-0.9.0/parameterized/test.py
===================================================================
--- parameterized-0.9.0.orig/parameterized/test.py
+++ parameterized-0.9.0/parameterized/test.py
@@ -480,7 +480,8 @@ def test_helpful_error_on_non_iterable_i
def tearDownModule():
missing = sorted(list(missing_tests))
- assert missing == []
+ # The best way how to fix gh#wolever/parameterized#167
+ # assert missing == []
def test_old_style_classes():
if PY3: