python-pytest-cases
python-pytest-cases copied to clipboard
Re-optimize cases collection: parametrized cases do not always need to be turned into fixtures
As noted in #158 , since 3.0.0 all parametrized cases are turned into fixtures. This ensures solid support for all kind of complex nesting and fixtures depenencies. However maybe we could simplify this when a case is parametrized but the parametrization does not contain any fixture reference ? In that case we still need to make sure that if there are lazy values, the "lazyness" needs to be intelligently combined. OR, an alternative is to only simplify when there are no fixture refs NOR lazy values.
Note that #170 may solve this by supporting parametrized lazy_values
One aspect that needs not to be forgotten is how easy the parameter of a case function can be accessed afterwards. With the current situation (parametrized cases = fixtures) it is relatively easy, see https://github.com/smarie/python-pytest-cases/issues/211#issuecomment-846010431