I'm trying to build a plugin that will do something "special" with test
functions that are prefixed with "case_".  However, I'm having trouble
collecting those and using them with fixtures.

in conftest.py I have

def pytest_pycollect_makeitem(collector, name, obj):
    if inspect.isfunction(obj) and (name.startswith('case_'):
        Function = collector._getcustomclass("Function")
        return Function(name, parent=collector)

and in test_mything.py I have:

class TestSomething():
    @pytest.fixture
    def scenario(self):
        pass

    def case_1(self, scenario):
        pass

But when I run the test, I get an error "TypeError: case_1() missing 1
required positional argument: 'scenario'"

How can I create the item so that it runs with the specific fixtures?

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

Reply via email to