diff options
author | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2022-05-26 11:59:25 +0200 |
---|---|---|
committer | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2022-05-26 12:45:32 +0200 |
commit | 9c3bfb954f15cdd26777b967ee2ff4b8213ab634 (patch) | |
tree | 0bd9d95406732b808fefe60b2ae83a66f892a4aa /dev-python/parameterized | |
parent | dev-ruby/vlad: enable ruby31 (diff) | |
download | gentoo-9c3bfb954f15cdd26777b967ee2ff4b8213ab634.tar.gz gentoo-9c3bfb954f15cdd26777b967ee2ff4b8213ab634.tar.bz2 gentoo-9c3bfb954f15cdd26777b967ee2ff4b8213ab634.zip |
dev-python/parameterized: nose --> pytest, enable py3.11
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'dev-python/parameterized')
-rw-r--r-- | dev-python/parameterized/files/parameterized-0.8.1-nose-to-pytest.patch | 101 | ||||
-rw-r--r-- | dev-python/parameterized/parameterized-0.8.1-r2.ebuild | 33 |
2 files changed, 134 insertions, 0 deletions
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 new file mode 100644 index 000000000000..45b86d8a13af --- /dev/null +++ b/dev-python/parameterized/files/parameterized-0.8.1-nose-to-pytest.patch @@ -0,0 +1,101 @@ +diff --git a/parameterized/test.py b/parameterized/test.py +index f98d865..ede7689 100644 +--- a/parameterized/test.py ++++ b/parameterized/test.py +@@ -2,8 +2,8 @@ + + import inspect + import mock ++import pytest + from unittest import TestCase +-from nose.tools import assert_equal, assert_raises + + from .parameterized import ( + PY3, PY2, parameterized, param, parameterized_argument_value_pairs, +@@ -91,7 +91,7 @@ if not PYTEST: + + @parameterized([(1, ), (2, )]) + def test_setup(self, count, *a): +- assert_equal(self.actual_order, "setup %s" %(count, )) ++ assert self.actual_order == "setup %s" %(count, ) + missing_tests.remove("test_setup(%s)" %(self.actual_order, )) + + +@@ -235,9 +235,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_" + str(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)) + + +@@ -259,7 +259,7 @@ class TestParameterizedExpandDocstring(TestCase): + 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") +@@ -335,7 +335,7 @@ def test_helpful_error_on_empty_iterable_input(): + + 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(): +@@ -366,10 +366,6 @@ def test_helpful_error_on_non_iterable_input(): + raise AssertionError("Expected exception not raised") + + +-def tearDownModule(): +- missing = sorted(list(missing_tests)) +- assert_equal(missing, []) +- + def test_old_style_classes(): + if PY3: + raise SkipTest("Py3 doesn't have old-style classes") +@@ -418,7 +414,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([ +@@ -428,7 +424,7 @@ def test_parameterized_argument_value_pairs(func_params, p, expected): + (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", ), +@@ -442,7 +438,7 @@ cases_over_10 = [(i, i+1) for i in range(11)] + + @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"), [ +@@ -461,7 +457,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, diff --git a/dev-python/parameterized/parameterized-0.8.1-r2.ebuild b/dev-python/parameterized/parameterized-0.8.1-r2.ebuild new file mode 100644 index 000000000000..06dbc5e9d590 --- /dev/null +++ b/dev-python/parameterized/parameterized-0.8.1-r2.ebuild @@ -0,0 +1,33 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{8..11} ) + +inherit distutils-r1 + +DESCRIPTION="Parameterized testing with any Python test framework" +HOMEPAGE="https://github.com/wolever/parameterized/" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + +BDEPEND=" + test? ( + dev-python/mock[${PYTHON_USEDEP}] + ) +" + +PATCHES=( + "${FILESDIR}/${P}-nose-to-pytest.patch" +) + +distutils_enable_tests pytest + +python_test() { + epytest parameterized/test.py +} |