Skip to content
Advertisement

Pytest: Nested use of request fixture

I’d like to get some help on how to run pytests with multiple layers of parameterized pytest fixtures.

I have a global request-based fixture for selecting a base implementation of the system I’d like to test:

JavaScript

I’d like to now run some additionally-parametrized tests against different test cases on the backend.

JavaScript

Using these two layers of fixtures, I’d like to be able to run both tests parameterised by the base-implementation.

JavaScript

And tests that use all the additional cases

JavaScript

At the moment, my test setup fails with:

JavaScript

How could I set up my test suite to run these levels of parameterization?

Advertisement

Answer

Ensure the fixture cache is filled with one and two fixture values when calling getfixturevalue() by adding both fixtures as letter_cases dependencies:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement