Q: Can we define pytest hooks inside the test class? I have a test folder with test.py and conftest.py files. I successfully implemented the pytest hook pytest_collection_modifyitems in conftest.py to skip some tests in test.py. Now I created a new folder (test2) with test.py only and I want to replicate the same skipping of the tests with the pytest_collection_modifyitems hook implemented in test.py.
Is it possible to define a pytest hook inside the test class directly? If yes, how can you do it?
I tried to define the hook inside the test class test.py using annotation @pytest.hookimpl but the method is completely ignored when executing pytest test.py.
Thank you for your help!
