I have a fixture that creates a list of items during tests. I want to have another fixture which is parametrized with values generated by the first one.
Example cod
This seems like a misunderstanding of the concept of fixtures and its difference with the concept of parameters.
Pytest has two major phases:
a collection phase where the goal is to create a list of test "nodes" to run. One test "node" corresponds to one test id, and means one value for each parameter. In this phase fixtures are NOT executed, only the decorator marks (containing parameters) are read. Therefore only parameters declared in the decorators can influence this phase
an execution phase where each test node is run. Before the run, all required fixtures that are not already setup are setup. Therefore the fixture functions are executed in this phase, and only in this phase.
In your example, you want the result of a fixture setup (phase B) to change the list of tests to create (phase A): this is not possible by design. You have to create this list somewhere else, for example in a pytest init hook in a conftest.py or simply as a shared variable in any of your test modules, and refer to it in the parameters of your test or fixture.
See also this question that is quite similar: Parametrizing tests depending of also parametrized values in pytest
Note that to complement hoefling's comment to your question you can now use a parametrized fixture in a parameters list: I have added this feature as a beta in my pytest-cases plugin, for evaluation, so that we can eventually propose to merge it within pytest (see this discussion, so not hesitate to provide feedback!). But unfortunately this will not solve the precise problem you describe in this post, for the fundamental reason described above.