python-pytest-cases icon indicating copy to clipboard operation
python-pytest-cases copied to clipboard

Re-optimize cases collection: parametrized cases do not always need to be turned into fixtures

Open smarie opened this issue 4 years ago • 2 comments
trafficstars

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.

smarie avatar Dec 16 '20 16:12 smarie

Note that #170 may solve this by supporting parametrized lazy_values

smarie avatar Dec 18 '20 13:12 smarie

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

smarie avatar May 21 '21 15:05 smarie