I want to automatically mark tests based on which fixtures they use. For instance, if a test uses a fixture named spark, I'd like to add a marker called uses_spark so that I can automatically ignore them.
I know I can use pytest_collection_modifyitems in conftest.py to add markers.
def pytest_collection_modifyitems(items):
for item in items:
if uses_spark_fixture(item):
item.add_marker(pytest.mark.spark)
def uses_spark_fixture(item):
???
How do I implement uses_spark_fixture?