54 lines
2.0 KiB
Diff
54 lines
2.0 KiB
Diff
|
|
From fc3c3a92c9c53d923e1f9b1ab11d3362c73ac99d Mon Sep 17 00:00:00 2001
|
||
|
|
From: Balint Reczey <balint.reczey@canonical.com>
|
||
|
|
Date: Tue, 5 Nov 2019 16:49:25 +0100
|
||
|
|
Subject: [PATCH] Mark issue56 in a way that works wity pytest 4
|
||
|
|
|
||
|
|
reference: https://github.com/hamcrest/PyHamcrest/commit/fc3c3a92c9c53d923e1f9b1ab11d3362c73ac99d
|
||
|
|
|
||
|
|
---
|
||
|
|
pytest.ini | 2 ++
|
||
|
|
tests/hamcrest_unit_test/core/is_test.py | 2 +-
|
||
|
|
tests/hamcrest_unit_test/core/isinstanceof_test.py | 7 -------
|
||
|
|
3 files changed, 3 insertions(+), 8 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/pytest.ini b/pytest.ini
|
||
|
|
index 80c7b6a..55c7e5f 100644
|
||
|
|
--- a/pytest.ini
|
||
|
|
+++ b/pytest.ini
|
||
|
|
@@ -1,2 +1,4 @@
|
||
|
|
[pytest]
|
||
|
|
addopts = --cov hamcrest --cov-report term-missing --no-cov-on-fail
|
||
|
|
+markers =
|
||
|
|
+ issue56
|
||
|
|
diff --git a/tests/hamcrest_unit_test/core/is_test.py b/tests/hamcrest_unit_test/core/is_test.py
|
||
|
|
index 9205ddb..e0bd23d 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', (
|
||
|
|
diff --git a/tests/hamcrest_unit_test/core/isinstanceof_test.py b/tests/hamcrest_unit_test/core/isinstanceof_test.py
|
||
|
|
index 862fd06..9f4608b 100644
|
||
|
|
--- a/tests/hamcrest_unit_test/core/isinstanceof_test.py
|
||
|
|
+++ b/tests/hamcrest_unit_test/core/isinstanceof_test.py
|
||
|
|
@@ -41,13 +41,6 @@ def test_matching_evaluation(arg, matcher):
|
||
|
|
def test_mismatching_evaluation(arg, matcher):
|
||
|
|
assert_does_not_match(matcher, arg, 'mismatched')
|
||
|
|
|
||
|
|
-@pytest.mark.parametrize('obj', (
|
||
|
|
- pytest.mark.issue56(()),
|
||
|
|
- 'str',
|
||
|
|
-))
|
||
|
|
-def test_matcher_creation_requires_type(obj):
|
||
|
|
- with pytest.raises(TypeError):
|
||
|
|
- instance_of(obj)
|
||
|
|
|
||
|
|
@pytest.mark.parametrize('desc, type', (
|
||
|
|
('an instance of int', int),
|