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