Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/parameterized/, dev-python/parameterized/files/
Date: Thu, 26 May 2022 10:45:48
Message-Id: 1653561932.9c3bfb954f15cdd26777b967ee2ff4b8213ab634.andrewammerlaan@gentoo
1 commit: 9c3bfb954f15cdd26777b967ee2ff4b8213ab634
2 Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 26 09:59:25 2022 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Thu May 26 10:45:32 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c3bfb95
7
8 dev-python/parameterized: nose --> pytest, enable py3.11
9
10 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
11
12 .../files/parameterized-0.8.1-nose-to-pytest.patch | 101 +++++++++++++++++++++
13 .../parameterized/parameterized-0.8.1-r2.ebuild | 33 +++++++
14 2 files changed, 134 insertions(+)
15
16 diff --git a/dev-python/parameterized/files/parameterized-0.8.1-nose-to-pytest.patch b/dev-python/parameterized/files/parameterized-0.8.1-nose-to-pytest.patch
17 new file mode 100644
18 index 000000000000..45b86d8a13af
19 --- /dev/null
20 +++ b/dev-python/parameterized/files/parameterized-0.8.1-nose-to-pytest.patch
21 @@ -0,0 +1,101 @@
22 +diff --git a/parameterized/test.py b/parameterized/test.py
23 +index f98d865..ede7689 100644
24 +--- a/parameterized/test.py
25 ++++ b/parameterized/test.py
26 +@@ -2,8 +2,8 @@
27 +
28 + import inspect
29 + import mock
30 ++import pytest
31 + from unittest import TestCase
32 +-from nose.tools import assert_equal, assert_raises
33 +
34 + from .parameterized import (
35 + PY3, PY2, parameterized, param, parameterized_argument_value_pairs,
36 +@@ -91,7 +91,7 @@ if not PYTEST:
37 +
38 + @parameterized([(1, ), (2, )])
39 + def test_setup(self, count, *a):
40 +- assert_equal(self.actual_order, "setup %s" %(count, ))
41 ++ assert self.actual_order == "setup %s" %(count, )
42 + missing_tests.remove("test_setup(%s)" %(self.actual_order, ))
43 +
44 +
45 +@@ -235,9 +235,9 @@ class TestParamerizedOnTestCase(TestCase):
46 + frame_locals = frame[0].f_locals
47 + nose_test_method_name = frame_locals['a'][0]._testMethodName
48 + expected_name = "test_on_TestCase2_custom_name_" + str(foo)
49 +- assert_equal(nose_test_method_name, expected_name,
50 +- "Test Method name '%s' did not get customized to expected: '%s'" %
51 +- (nose_test_method_name, expected_name))
52 ++ assert nose_test_method_name == expected_name, \
53 ++ "Test Method name '%s' did not get customized to expected: '%s'" % \
54 ++ (nose_test_method_name, expected_name)
55 + missing_tests.remove("%s(%r, bar=%r)" %(expected_name, foo, bar))
56 +
57 +
58 +@@ -259,7 +259,7 @@ class TestParameterizedExpandDocstring(TestCase):
59 + actual_docstring = test_method.__doc__
60 + if rstrip:
61 + actual_docstring = actual_docstring.rstrip()
62 +- assert_equal(actual_docstring, expected_docstring)
63 ++ assert actual_docstring == expected_docstring
64 +
65 + @parameterized.expand([param("foo")],
66 + doc_func=lambda f, n, p: "stuff")
67 +@@ -335,7 +335,7 @@ def test_helpful_error_on_empty_iterable_input():
68 +
69 + def test_skip_test_on_empty_iterable():
70 + func = parameterized([], skip_on_empty=True)(lambda: None)
71 +- assert_raises(SkipTest, func)
72 ++ pytest.raises(SkipTest, func)
73 +
74 +
75 + def test_helpful_error_on_empty_iterable_input_expand():
76 +@@ -366,10 +366,6 @@ def test_helpful_error_on_non_iterable_input():
77 + raise AssertionError("Expected exception not raised")
78 +
79 +
80 +-def tearDownModule():
81 +- missing = sorted(list(missing_tests))
82 +- assert_equal(missing, [])
83 +-
84 + def test_old_style_classes():
85 + if PY3:
86 + raise SkipTest("Py3 doesn't have old-style classes")
87 +@@ -418,7 +414,7 @@ class TestOldStyleClass:
88 + def test_parameterized_argument_value_pairs(func_params, p, expected):
89 + helper = eval("lambda %s: None" %(func_params, ))
90 + actual = parameterized_argument_value_pairs(helper, p)
91 +- assert_equal(actual, expected)
92 ++ assert actual == expected
93 +
94 +
95 + @parameterized([
96 +@@ -428,7 +424,7 @@ def test_parameterized_argument_value_pairs(func_params, p, expected):
97 + (123456789, "12...89", 4),
98 + ])
99 + def test_short_repr(input, expected, n=6):
100 +- assert_equal(short_repr(input, n=n), expected)
101 ++ assert short_repr(input, n=n) == expected
102 +
103 + @parameterized([
104 + ("foo", ),
105 +@@ -442,7 +438,7 @@ cases_over_10 = [(i, i+1) for i in range(11)]
106 +
107 + @parameterized(cases_over_10)
108 + def test_cases_over_10(input, expected):
109 +- assert_equal(input, expected-1)
110 ++ assert input == expected-1
111 +
112 +
113 + @parameterized_class(("a", "b", "c"), [
114 +@@ -461,7 +457,7 @@ class TestParameterizedClass(TestCase):
115 +
116 + def _assertions(self, test_name):
117 + assert hasattr(self, "a")
118 +- assert_equal(self.b + self.c, 3)
119 ++ assert self.b + self.c == 3
120 + missing_tests.remove("%s:%s(%r, %r, %r)" %(
121 + self.__class__.__name__,
122 + test_name,
123
124 diff --git a/dev-python/parameterized/parameterized-0.8.1-r2.ebuild b/dev-python/parameterized/parameterized-0.8.1-r2.ebuild
125 new file mode 100644
126 index 000000000000..06dbc5e9d590
127 --- /dev/null
128 +++ b/dev-python/parameterized/parameterized-0.8.1-r2.ebuild
129 @@ -0,0 +1,33 @@
130 +# Copyright 1999-2022 Gentoo Authors
131 +# Distributed under the terms of the GNU General Public License v2
132 +
133 +EAPI=8
134 +
135 +DISTUTILS_USE_PEP517=setuptools
136 +PYTHON_COMPAT=( python3_{8..11} )
137 +
138 +inherit distutils-r1
139 +
140 +DESCRIPTION="Parameterized testing with any Python test framework"
141 +HOMEPAGE="https://github.com/wolever/parameterized/"
142 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
143 +
144 +LICENSE="BSD"
145 +SLOT="0"
146 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
147 +
148 +BDEPEND="
149 + test? (
150 + dev-python/mock[${PYTHON_USEDEP}]
151 + )
152 +"
153 +
154 +PATCHES=(
155 + "${FILESDIR}/${P}-nose-to-pytest.patch"
156 +)
157 +
158 +distutils_enable_tests pytest
159 +
160 +python_test() {
161 + epytest parameterized/test.py
162 +}