Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
get_marker for older pytest
diff --git a/convert2rhel/unit_tests/conftest.py b/convert2rhel/unit_tests/conftest.py
index 40ccf0b..acdd1d1 100644
--- a/convert2rhel/unit_tests/conftest.py
+++ b/convert2rhel/unit_tests/conftest.py
@@ -82,8 +82,11 @@ def system_cert_with_target_path(monkeypatch, tmpdir, request):
.. seealso::
https://docs.pytest.org/en/7.1.x/how-to/fixtures.html#using-markers-to-pass-data-to-fixtures
"""
+ if pytest.__version__.split('.') <= ('3', '6', '0'):
+ mark = request.node.get_marker("cert_filename")
+ else:
+ mark = request.node.get_closest_marker("cert_filename")
- mark = request.node.get_closest_marker("cert_filename")
if not mark:
temporary_filename = "filename"
else:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment