Blob Blame History Raw
From a916909e315eb219f79b99d927c54028d7af1fc4 Mon Sep 17 00:00:00 2001
From: Simon Brunning <simon@brunningonline.net>
Date: Fri, 2 Nov 2018 09:50:20 +0000
Subject: [PATCH] Silence warnings from tests due to use of old
 pytest.parameterize() signature.

---
 tests/hamcrest_unit_test/base_description_test.py  | 8 ++++----
 tests/hamcrest_unit_test/core/is_test.py           | 4 ++--
 tests/hamcrest_unit_test/core/isinstanceof_test.py | 8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tests/hamcrest_unit_test/base_description_test.py b/tests/hamcrest_unit_test/base_description_test.py
index 43d9bc9..ce76557 100644
--- a/tests/hamcrest_unit_test/base_description_test.py
+++ b/tests/hamcrest_unit_test/base_description_test.py
@@ -34,10 +34,10 @@ def test_append_text_delegates(desc):
 
 @pytest.mark.parametrize('described, appended', (
     (Described(), 'described'),
-    pytest.mark.skipif(six.PY3, reason="py2 only")((six.u('unicode-py2'), "'unicode-py2'")),
-    pytest.mark.skipif(six.PY3, reason="py2 only")((six.b('bytes-py2'), "'bytes-py2'")),
-    pytest.mark.skipif(six.PY2, reason="py3 only")((six.u('unicode-py3'), "'unicode-py3'")),
-    pytest.mark.skipif(six.PY2, reason="py3 only")((six.b('bytes-py3'), "<b'bytes-py3'>")),
+    pytest.param(six.u('unicode-py2'), "'unicode-py2'", marks=pytest.mark.skipif(six.PY3, reason="py2 only")),
+    pytest.param(six.b('bytes-py2'), "'bytes-py2'", marks=pytest.mark.skipif(six.PY3, reason="py2 only")),
+    pytest.param(six.u('unicode-py3'), "'unicode-py3'", marks=pytest.mark.skipif(six.PY2, reason="py3 only")),
+    pytest.param(six.b('bytes-py3'), "<b'bytes-py3'>", marks=pytest.mark.skipif(six.PY2, reason="py3 only")),
     (six.u("\U0001F4A9"), six.u("'{0}'").format(six.u("\U0001F4A9"))),
 ))
 def test_append_description_types(desc, described, appended):
diff --git a/tests/hamcrest_unit_test/core/is_test.py b/tests/hamcrest_unit_test/core/is_test.py
index 9205ddb..632c67c 100644
--- a/tests/hamcrest_unit_test/core/is_test.py
+++ b/tests/hamcrest_unit_test/core/is_test.py
@@ -39,7 +39,7 @@ def test_description_should_pass_through_matcher():
 equal_matches = pytest.mark.parametrize('arg, identity, desc', (
     ('A', 'A', "'A'"),
     (5 + 3, 8, "<8>"),
-    pytest.mark.issue56((tuple(), (), "<()>")),
+    pytest.param(tuple(), (), "<()>", marks=pytest.mark.issue56()),
 ))
 
 equal_mismatches = pytest.mark.parametrize('arg, identity, desc', (
@@ -65,7 +65,7 @@ def test_description_uses_equal_to(arg, identity, desc):
 @pytest.mark.parametrize('arg, identity', (
     ('A', str),
     (1, int),
-    only_py2((OldClass(), OldClass)),
+    pytest.param(OldClass(), OldClass, marks=only_py2()),
 ))
 def test_provides_instanceof_shortcut(arg, identity):
     assert_matches(is_(identity), arg, "should match")
diff --git a/tests/hamcrest_unit_test/core/isinstanceof_test.py b/tests/hamcrest_unit_test/core/isinstanceof_test.py
index 862fd06..f74b84d 100644
--- a/tests/hamcrest_unit_test/core/isinstanceof_test.py
+++ b/tests/hamcrest_unit_test/core/isinstanceof_test.py
@@ -26,7 +26,7 @@ class Child(Parent):
     ('foo', instance_of((str, int))),
     (1, instance_of((int, str))),
     ('foo', instance_of((int, str))),
-    only_py2((Parent(), instance_of(Parent))),
+    pytest.param(Parent(), instance_of(Parent), marks=only_py2()),
 ))
 def test_matching_evaluation(arg, matcher):
     assert_matches(matcher, arg, 'same class')
@@ -35,14 +35,14 @@ def test_matching_evaluation(arg, matcher):
 @pytest.mark.parametrize('arg, matcher', (
     ('hi', instance_of(int)),
     (None, instance_of(int)),
-    only_py2(('not a parent', instance_of(Parent))),
-    only_py2((None, instance_of(Parent))),
+    pytest.param('not a parent', instance_of(Parent), marks=only_py2()),
+    pytest.param(None, instance_of(Parent), marks=only_py2()),
 ))
 def test_mismatching_evaluation(arg, matcher):
     assert_does_not_match(matcher, arg, 'mismatched')
 
 @pytest.mark.parametrize('obj', (
-    pytest.mark.issue56(()),
+    pytest.param((), marks=pytest.mark.issue56()),
     'str',
 ))
 def test_matcher_creation_requires_type(obj):
-- 
2.21.0