I am writing a pytest plugin to order your tests before running them. I need a better way to write tests for my plugin.
I use pytest pytest_collection_modifyitems hook , and then changes itemsin place based on specific markers. The easiest way to check this would be to have an input list of pytest tests, pass them to my function and state that the output is in the correct order.
I am having problems collecting or creating input test lists. Input tests should be in the same format as pytest will be passed as itemsin hook pytest_collection_modifyitems, i.e. They must be instances _pytest.python.Functionwith appropriate markers.
I will accept answers for: 1) collecting tests using the existing Python module or 2) programmatically creating instances _pytest.python.Functionthat look like this would be passed in a hook pytest_collection_modifyitems. All that makes it easy to generate test data.
source
share