Markéta Machová
877e19b915
- 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 OBS-URL: https://build.opensuse.org/request/show/970235 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-parameterized?expand=0&rev=24
124 lines
4.6 KiB
Diff
124 lines
4.6 KiB
Diff
---
|
|
parameterized/parameterized.py | 7 ++++---
|
|
parameterized/test.py | 30 ++++++++++++++++--------------
|
|
2 files changed, 20 insertions(+), 17 deletions(-)
|
|
|
|
Index: parameterized-0.8.1/parameterized/test.py
|
|
===================================================================
|
|
--- parameterized-0.8.1.orig/parameterized/test.py
|
|
+++ parameterized-0.8.1/parameterized/test.py
|
|
@@ -3,7 +3,7 @@
|
|
import inspect
|
|
import mock
|
|
from unittest import TestCase
|
|
-from nose.tools import assert_equal, assert_raises
|
|
+import pytest
|
|
|
|
from .parameterized import (
|
|
PY3, PY2, PYTEST4, parameterized, param,
|
|
@@ -91,12 +91,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, kw_name):
|
|
@@ -248,9 +248,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) + "_" + str(bar)
|
|
- 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))
|
|
|
|
|
|
@@ -272,7 +272,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")
|
|
@@ -348,7 +348,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():
|
|
@@ -381,7 +381,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:
|
|
@@ -433,7 +433,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([
|
|
@@ -443,7 +443,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", ),
|
|
@@ -457,7 +457,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"), [
|
|
@@ -476,7 +476,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,
|
|
Index: parameterized-0.8.1/parameterized/parameterized.py
|
|
===================================================================
|
|
--- parameterized-0.8.1.orig/parameterized/parameterized.py
|
|
+++ parameterized-0.8.1/parameterized/parameterized.py
|
|
@@ -286,7 +286,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",
|
|
}
|