Created
August 5, 2022 18:16
-
-
Save abadger/3b7a1cb42ae736cc9f25145969812817 to your computer and use it in GitHub Desktop.
get_marker for older pytest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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