You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
3.0 KiB
87 lines
3.0 KiB
From c1c1b14d359b1360e7d14a7c0687bef9ed6fc17c Mon Sep 17 00:00:00 2001
|
|
From: Christian Heimes <cheimes@redhat.com>
|
|
Date: Wed, 28 Oct 2020 14:27:55 +0100
|
|
Subject: [PATCH 2] Support pytest 3.4.2
|
|
|
|
---
|
|
setup.py | 3 ++-
|
|
tests/conftest.py | 4 ++--
|
|
tests/test_utils.py | 4 ++--
|
|
tests/utils.py | 2 +-
|
|
4 files changed, 7 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/setup.py b/setup.py
|
|
index 82800a96e..5678db004 100644
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -93,7 +93,8 @@ setup(
|
|
extras_require={
|
|
":python_version < '3'": ["enum34", "ipaddress"],
|
|
"test": [
|
|
- "pytest>=3.6.0,!=3.9.0,!=3.9.1,!=3.9.2",
|
|
+ "pytest>=3.4.2,<3.6",
|
|
+ "attrs>=17.4.0,<18.0",
|
|
"pretend",
|
|
"iso8601",
|
|
"pytz",
|
|
diff --git a/tests/conftest.py b/tests/conftest.py
|
|
index 4e3124fa7..53c194830 100644
|
|
--- a/tests/conftest.py
|
|
+++ b/tests/conftest.py
|
|
@@ -42,7 +42,7 @@ def pytest_generate_tests(metafunc):
|
|
|
|
def pytest_runtest_setup(item):
|
|
if openssl_backend._fips_enabled:
|
|
- for marker in item.iter_markers(name="skip_fips"):
|
|
+ for marker in item.get_marker(name="skip_fips") or []:
|
|
pytest.skip(marker.kwargs["reason"])
|
|
|
|
|
|
@@ -50,7 +50,7 @@ def pytest_runtest_setup(item):
|
|
def backend(request):
|
|
required_interfaces = [
|
|
mark.kwargs["interface"]
|
|
- for mark in request.node.iter_markers("requires_backend_interface")
|
|
+ for mark in request.node.get_marker("requires_backend_interface") or []
|
|
]
|
|
if not all(
|
|
isinstance(openssl_backend, iface) for iface in required_interfaces
|
|
diff --git a/tests/test_utils.py b/tests/test_utils.py
|
|
index d6afa3b34..e0a1be4f5 100644
|
|
--- a/tests/test_utils.py
|
|
+++ b/tests/test_utils.py
|
|
@@ -43,7 +43,7 @@ def test_check_backend_support_skip():
|
|
supported = pretend.stub(
|
|
kwargs={"only_if": lambda backend: False, "skip_message": "Nope"}
|
|
)
|
|
- node = pretend.stub(iter_markers=lambda x: [supported])
|
|
+ node = pretend.stub(get_marker=lambda x: [supported])
|
|
item = pretend.stub(node=node)
|
|
with pytest.raises(pytest.skip.Exception) as exc_info:
|
|
check_backend_support(True, item)
|
|
@@ -54,7 +54,7 @@ def test_check_backend_support_no_skip():
|
|
supported = pretend.stub(
|
|
kwargs={"only_if": lambda backend: True, "skip_message": "Nope"}
|
|
)
|
|
- node = pretend.stub(iter_markers=lambda x: [supported])
|
|
+ node = pretend.stub(get_marker=lambda x: [supported])
|
|
item = pretend.stub(node=node)
|
|
assert check_backend_support(None, item) is None
|
|
|
|
diff --git a/tests/utils.py b/tests/utils.py
|
|
index 5d98af00e..a08f79c34 100644
|
|
--- a/tests/utils.py
|
|
+++ b/tests/utils.py
|
|
@@ -27,7 +27,7 @@ KeyedHashVector = collections.namedtuple(
|
|
|
|
|
|
def check_backend_support(backend, item):
|
|
- for mark in item.node.iter_markers("supported"):
|
|
+ for mark in item.node.get_marker("supported") or []:
|
|
if not mark.kwargs["only_if"](backend):
|
|
pytest.skip("{} ({})".format(mark.kwargs["skip_message"], backend))
|
|
|
|
--
|
|
2.26.2
|
|
|