aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2018-09-06 22:56:46 -0500
committerAlex Gaynor <alex.gaynor@gmail.com>2018-09-06 23:56:46 -0400
commit0322962e143798fa5228f4505eeb606cdf773b87 (patch)
tree4cf5c56697f7e7f54d3166425cb180f8f6efe458
parentf88aea5d8b9452677bd23a9bba917b900cd634c0 (diff)
downloadcryptography-0322962e143798fa5228f4505eeb606cdf773b87.tar.gz
cryptography-0322962e143798fa5228f4505eeb606cdf773b87.tar.bz2
cryptography-0322962e143798fa5228f4505eeb606cdf773b87.zip
update pytest config (#4463)
* update pytest config pytest 3.8.0 was just released and officially deprecates some of the way we do pytest marks. They introduced a new way to do this in 3.6 so this PR switches to that mechanism and updates our minimum pytest requirement * update the stubs * also update wycheproof test config to remove deprecated paths * don't need this any more
-rw-r--r--setup.py2
-rw-r--r--tests/conftest.py5
-rw-r--r--tests/test_utils.py6
-rw-r--r--tests/utils.py12
4 files changed, 13 insertions, 12 deletions
diff --git a/setup.py b/setup.py
index 8bd31bd5..0c793e32 100644
--- a/setup.py
+++ b/setup.py
@@ -54,7 +54,7 @@ if platform.python_implementation() == "PyPy":
)
test_requirements = [
- "pytest>=3.2.1,!=3.3.0",
+ "pytest>=3.6.0",
"pretend",
"iso8601",
"pytz",
diff --git a/tests/conftest.py b/tests/conftest.py
index 583c4099..d858b4f7 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -27,7 +27,8 @@ def pytest_generate_tests(metafunc):
skip_if_wycheproof_none(wycheproof)
testcases = []
- for path in metafunc.function.wycheproof_tests.args:
+ marker = metafunc.definition.get_closest_marker("wycheproof_tests")
+ for path in marker.args:
testcases.extend(load_wycheproof_tests(wycheproof, path))
metafunc.parametrize("wycheproof", testcases)
@@ -36,7 +37,7 @@ def pytest_generate_tests(metafunc):
def backend(request):
required_interfaces = [
mark.kwargs["interface"]
- for mark in request.node.get_marker("requires_backend_interface")
+ for mark in request.node.iter_markers("requires_backend_interface")
]
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 181d9833..81656eb9 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -32,7 +32,8 @@ def test_check_backend_support_skip():
supported = pretend.stub(
kwargs={"only_if": lambda backend: False, "skip_message": "Nope"}
)
- item = pretend.stub(keywords={"supported": [supported]})
+ node = pretend.stub(iter_markers=lambda x: [supported])
+ item = pretend.stub(node=node)
with pytest.raises(pytest.skip.Exception) as exc_info:
check_backend_support(True, item)
assert exc_info.value.args[0] == "Nope (True)"
@@ -42,7 +43,8 @@ def test_check_backend_support_no_skip():
supported = pretend.stub(
kwargs={"only_if": lambda backend: True, "skip_message": "Nope"}
)
- item = pretend.stub(keywords={"supported": [supported]})
+ node = pretend.stub(iter_markers=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 b950f8bd..af7f766c 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -28,13 +28,11 @@ KeyedHashVector = collections.namedtuple(
def check_backend_support(backend, item):
- supported = item.keywords.get("supported")
- if supported:
- for mark in supported:
- if not mark.kwargs["only_if"](backend):
- pytest.skip("{0} ({1})".format(
- mark.kwargs["skip_message"], backend
- ))
+ for mark in item.node.iter_markers("supported"):
+ if not mark.kwargs["only_if"](backend):
+ pytest.skip("{0} ({1})".format(
+ mark.kwargs["skip_message"], backend
+ ))
@contextmanager