Skip to content

Instantly share code, notes, and snippets.

@abadger
Created August 8, 2022 16: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/2e6c53fb524d1a5f4a01109ce4e1c184 to your computer and use it in GitHub Desktop.
Save abadger/2e6c53fb524d1a5f4a01109ce4e1c184 to your computer and use it in GitHub Desktop.
full pytest testcase using get_marker on older pytest.
import pytest
@pytest.fixture
def system_cert_with_target_path(request):
print(pytest.__version__)
print(request.node)
print(dir(request.node))
if pytest.__version__.split('.') <= ('3', '6', '0'):
mark = request.node.get_marker("cert_filename")
else:
mark = request.node.get_closest_marker("cert_filename")
print(mark)
return mark
@pytest.mark.cert_filename('test')
def test_thing(system_cert_with_target_path):
print(system_cert_with_target_path)
assert False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment