|
|
e8d769 |
From a916909e315eb219f79b99d927c54028d7af1fc4 Mon Sep 17 00:00:00 2001
|
|
|
e8d769 |
From: Simon Brunning <simon@brunningonline.net>
|
|
|
e8d769 |
Date: Fri, 2 Nov 2018 09:50:20 +0000
|
|
|
e8d769 |
Subject: [PATCH] Silence warnings from tests due to use of old
|
|
|
e8d769 |
pytest.parameterize() signature.
|
|
|
e8d769 |
|
|
|
e8d769 |
---
|
|
|
e8d769 |
tests/hamcrest_unit_test/base_description_test.py | 8 ++++----
|
|
|
e8d769 |
tests/hamcrest_unit_test/core/is_test.py | 4 ++--
|
|
|
e8d769 |
tests/hamcrest_unit_test/core/isinstanceof_test.py | 8 ++++----
|
|
|
e8d769 |
3 files changed, 10 insertions(+), 10 deletions(-)
|
|
|
e8d769 |
|
|
|
e8d769 |
diff --git a/tests/hamcrest_unit_test/base_description_test.py b/tests/hamcrest_unit_test/base_description_test.py
|
|
|
e8d769 |
index 43d9bc9..ce76557 100644
|
|
|
e8d769 |
--- a/tests/hamcrest_unit_test/base_description_test.py
|
|
|
e8d769 |
+++ b/tests/hamcrest_unit_test/base_description_test.py
|
|
|
e8d769 |
@@ -34,10 +34,10 @@ def test_append_text_delegates(desc):
|
|
|
e8d769 |
|
|
|
e8d769 |
@pytest.mark.parametrize('described, appended', (
|
|
|
e8d769 |
(Described(), 'described'),
|
|
|
e8d769 |
- pytest.mark.skipif(six.PY3, reason="py2 only")((six.u('unicode-py2'), "'unicode-py2'")),
|
|
|
e8d769 |
- pytest.mark.skipif(six.PY3, reason="py2 only")((six.b('bytes-py2'), "'bytes-py2'")),
|
|
|
e8d769 |
- pytest.mark.skipif(six.PY2, reason="py3 only")((six.u('unicode-py3'), "'unicode-py3'")),
|
|
|
e8d769 |
- pytest.mark.skipif(six.PY2, reason="py3 only")((six.b('bytes-py3'), "<b'bytes-py3'>")),
|
|
|
e8d769 |
+ pytest.param(six.u('unicode-py2'), "'unicode-py2'", marks=pytest.mark.skipif(six.PY3, reason="py2 only")),
|
|
|
e8d769 |
+ pytest.param(six.b('bytes-py2'), "'bytes-py2'", marks=pytest.mark.skipif(six.PY3, reason="py2 only")),
|
|
|
e8d769 |
+ pytest.param(six.u('unicode-py3'), "'unicode-py3'", marks=pytest.mark.skipif(six.PY2, reason="py3 only")),
|
|
|
e8d769 |
+ pytest.param(six.b('bytes-py3'), "<b'bytes-py3'>", marks=pytest.mark.skipif(six.PY2, reason="py3 only")),
|
|
|
e8d769 |
(six.u("\U0001F4A9"), six.u("'{0}'").format(six.u("\U0001F4A9"))),
|
|
|
e8d769 |
))
|
|
|
e8d769 |
def test_append_description_types(desc, described, appended):
|
|
|
e8d769 |
diff --git a/tests/hamcrest_unit_test/core/is_test.py b/tests/hamcrest_unit_test/core/is_test.py
|
|
|
e8d769 |
index 9205ddb..632c67c 100644
|
|
|
e8d769 |
--- a/tests/hamcrest_unit_test/core/is_test.py
|
|
|
e8d769 |
+++ b/tests/hamcrest_unit_test/core/is_test.py
|
|
|
e8d769 |
@@ -39,7 +39,7 @@ def test_description_should_pass_through_matcher():
|
|
|
e8d769 |
equal_matches = pytest.mark.parametrize('arg, identity, desc', (
|
|
|
e8d769 |
('A', 'A', "'A'"),
|
|
|
e8d769 |
(5 + 3, 8, "<8>"),
|
|
|
e8d769 |
- pytest.mark.issue56((tuple(), (), "<()>")),
|
|
|
e8d769 |
+ pytest.param(tuple(), (), "<()>", marks=pytest.mark.issue56()),
|
|
|
e8d769 |
))
|
|
|
e8d769 |
|
|
|
e8d769 |
equal_mismatches = pytest.mark.parametrize('arg, identity, desc', (
|
|
|
e8d769 |
@@ -65,7 +65,7 @@ def test_description_uses_equal_to(arg, identity, desc):
|
|
|
e8d769 |
@pytest.mark.parametrize('arg, identity', (
|
|
|
e8d769 |
('A', str),
|
|
|
e8d769 |
(1, int),
|
|
|
e8d769 |
- only_py2((OldClass(), OldClass)),
|
|
|
e8d769 |
+ pytest.param(OldClass(), OldClass, marks=only_py2()),
|
|
|
e8d769 |
))
|
|
|
e8d769 |
def test_provides_instanceof_shortcut(arg, identity):
|
|
|
e8d769 |
assert_matches(is_(identity), arg, "should match")
|
|
|
e8d769 |
diff --git a/tests/hamcrest_unit_test/core/isinstanceof_test.py b/tests/hamcrest_unit_test/core/isinstanceof_test.py
|
|
|
e8d769 |
index 862fd06..f74b84d 100644
|
|
|
e8d769 |
--- a/tests/hamcrest_unit_test/core/isinstanceof_test.py
|
|
|
e8d769 |
+++ b/tests/hamcrest_unit_test/core/isinstanceof_test.py
|
|
|
e8d769 |
@@ -26,7 +26,7 @@ class Child(Parent):
|
|
|
e8d769 |
('foo', instance_of((str, int))),
|
|
|
e8d769 |
(1, instance_of((int, str))),
|
|
|
e8d769 |
('foo', instance_of((int, str))),
|
|
|
e8d769 |
- only_py2((Parent(), instance_of(Parent))),
|
|
|
e8d769 |
+ pytest.param(Parent(), instance_of(Parent), marks=only_py2()),
|
|
|
e8d769 |
))
|
|
|
e8d769 |
def test_matching_evaluation(arg, matcher):
|
|
|
e8d769 |
assert_matches(matcher, arg, 'same class')
|
|
|
e8d769 |
@@ -35,14 +35,14 @@ def test_matching_evaluation(arg, matcher):
|
|
|
e8d769 |
@pytest.mark.parametrize('arg, matcher', (
|
|
|
e8d769 |
('hi', instance_of(int)),
|
|
|
e8d769 |
(None, instance_of(int)),
|
|
|
e8d769 |
- only_py2(('not a parent', instance_of(Parent))),
|
|
|
e8d769 |
- only_py2((None, instance_of(Parent))),
|
|
|
e8d769 |
+ pytest.param('not a parent', instance_of(Parent), marks=only_py2()),
|
|
|
e8d769 |
+ pytest.param(None, instance_of(Parent), marks=only_py2()),
|
|
|
e8d769 |
))
|
|
|
e8d769 |
def test_mismatching_evaluation(arg, matcher):
|
|
|
e8d769 |
assert_does_not_match(matcher, arg, 'mismatched')
|
|
|
e8d769 |
|
|
|
e8d769 |
@pytest.mark.parametrize('obj', (
|
|
|
e8d769 |
- pytest.mark.issue56(()),
|
|
|
e8d769 |
+ pytest.param((), marks=pytest.mark.issue56()),
|
|
|
e8d769 |
'str',
|
|
|
e8d769 |
))
|
|
|
e8d769 |
def test_matcher_creation_requires_type(obj):
|
|
|
e8d769 |
--
|
|
|
e8d769 |
2.21.0
|
|
|
e8d769 |
|