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