Hi there

Not sure if I'm missing something in the docs. I'm trying to add a marker
to every test that's decorated with a given fixture. What I have currently
is this:

def pytest_itemcollected(item):
    if 'solr' in item.fixturenames:
        # so you can skip it with "-m 'not solr'"
        item.add_marker('solr')


This sort of works ( the marker is present by the time the test runs), but
command-line filtering options (`-m 'not solr'`) don't filter based on it.
I guess this hook is running after those options have been consulted?

I also tried the same thing in pytest_collection_modifyitems, but that
happens later so is even less likely to work.

Is there an earlier hook where I can modify an item before the command line
filtering options are checked?

Thanks
Craig
_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to