Skip to content

Instantly share code, notes, and snippets.

@abadger
Created August 8, 2022 17:36
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/4448b01107da3bfbe0ebf2a5f383ad81 to your computer and use it in GitHub Desktop.
Save abadger/4448b01107da3bfbe0ebf2a5f383ad81 to your computer and use it in GitHub Desktop.
Possible fix for python-2.6's pytest
[root@c2r-20220808100827 convert2rhel]# git diff
diff --git a/convert2rhel/unit_tests/conftest.py b/convert2rhel/unit_tests/conftest.py
index d608201..3652831 100644
--- a/convert2rhel/unit_tests/conftest.py
+++ b/convert2rhel/unit_tests/conftest.py
@@ -118,7 +118,11 @@ def system_cert_with_target_path(monkeypatch, tmpdir, request):
https://docs.pytest.org/en/7.1.x/how-to/fixtures.html#using-markers-to-pass-data-to-fixtures
"""
- mark = request.node.get_closest_marker("cert_filename")
+ if pytest.__version__.split('.') <= ('3', '6', '0'):
+ mark = request.node.get_marker("cert_filename")
+ else:
+ 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