Skip to content

Instantly share code, notes, and snippets.

@abadger
Created August 5, 2022 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abadger/3b7a1cb42ae736cc9f25145969812817 to your computer and use it in GitHub Desktop.
Save abadger/3b7a1cb42ae736cc9f25145969812817 to your computer and use it in GitHub Desktop.
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