Sync from SUSE:SLFO:Main python-parameterized revision 90ceef2216a0c01be9a1a80e0dcf4525

This commit is contained in:
Adrian Schröter 2024-05-03 21:46:22 +02:00
commit c7c9c9a64e
6 changed files with 398 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

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

Binary file not shown.

View File

@ -0,0 +1,144 @@
-------------------------------------------------------------------
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
-------------------------------------------------------------------
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

85
python-parameterized.spec Normal file
View File

@ -0,0 +1,85 @@
#
# spec file for package python-parameterized
#
# Copyright (c) 2023 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
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
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
# https://github.com/wolever/parameterized/issues/122
sed -i 's:import mock:from unittest import mock:' parameterized/test.py
export LANG=en_US.UTF8
%if %{with nose2}
%{python_expand nose2-%$python_version -v -B --pretty-assert}
%endif
%python_exec -m unittest parameterized.test
# gh#wolever/parameterized#122
skip_tests="test_with_docstring_1_v_l_ or test_with_docstring_0_value1"
%pytest parameterized/test.py -k "not ($skip_tests)"
%files %{python_files}
%doc README.rst
# gh#wolever/parameterized#168
# %%doc CHANGELOG.txt
%license LICENSE.txt
%{python_sitelib}/parameterized
%{python_sitelib}/parameterized-%{version}*-info
%changelog

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: