NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #4464 most downloaded on PyPI
Separate test code from test cases in pytest.
Last release 7 months ago
02 Mar 2026
Release timing varies
gaps range from 8 days to 9 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
1 version withdrawn
withdrawn after publishing
8 years old
124 releases · first in 2018
Fixed python version in package metadata. 3.13 was missing.
3.13 was missing.See documentation page for details.
Fixed an issue with pytest 9 related to the fixture closure building fixes pytest-dev/pytest#13789, solving pytest-dev/pytest#13773. Fixed #374. PR #3
pytest 9 related to the fixture closure building fixes
pytest-dev/pytest#13789,
solving pytest-dev/pytest#13773.
Fixed #374. PR
#376 by jammer87.with_case_tags decorator for applying common tags to all cases
defined in a case class. Fixes #351.
PR #361
by @michele-riva.See documentation page for details.
One column per quarter.
Fixed AttributeError: 'MiniMetafunc' object has no attribute '_params_directness' when a case function is parametrized or requires a fixtures, with py
AttributeError: 'MiniMetafunc' object has no attribute '_params_directness' when a case function is
parametrized or requires a fixtures, with pytest 8.4.0. Fixed
#365ValueError: The provided fixture function does not seem to be a fixture with @fixture_ref with pytest
8.4.0. Fixed #364python<3.9 and pytest<6. Fixes
#362 and fixes
#186See documentation page for details.
Fixed AttributeError: 'MiniMetafunc' object has no attribute '_params_directness' when a case function is parametrized or requires a fixtures, with py
AttributeError: 'MiniMetafunc' object has no attribute '_params_directness' when a case function is
parametrized or requires a fixtures, with pytest 8.4.0. Fixed
#365ValueError: The provided fixture function does not seem to be a fixture with @fixture_ref with pytest
8.4.0. Fixed #364python<3.9 and pytest<6. Fixes
#362 and fixes
#186See documentation page for details.
Fixed issue with legacy python 2.7 and 3.5. Fixes #352.
See documentation page for details.
Fixed PytestRemovedIn9Warning: Marks applied to fixtures have no effect. Fixed #337
PytestRemovedIn9Warning: Marks applied to fixtures have no effect. Fixed
#337See documentation page for details.
Reverted DEBUG flag used for pytest 8 compatibility. Fixed #336
DEBUG flag used for pytest 8 compatibility. Fixed
#336See documentation page for details.
Fixed compliance with pytest 8. Fixed #330. PR #335 by smarie and larsoner.
See documentation page for details.
Fixed issue with upcoming pytest 8.1 release. PR #322 by @bluetech
pytest 8.1 release. PR
#322 by
@bluetechAUTO-cases lookup (cases_<name>.py instead of
case_<name>.py). PR #320
by @michele-riva.AssertionError on AUTO cases outside a 'normal' test module.
Fixes #309. PR
#320 by
@michele-riva.@parametrize_with_cases when the cases argument
is a string refering to a relative or absolute module name. Fixed import file mismatch with
pytest 8 when executing our own tests.
Fixes #323.event_loop_policy fixture that appeared in pytest-asyncio 0.23.
Fixes part of
#321.See documentation page for details.
Fixed ScopeMismatch with parametrized cases in non-trivial test trees. scope is now correctly handled for (i) fixture cases, and (ii) fixtures defined
ScopeMismatch with parametrized cases in non-trivial test
trees. scope is now correctly handled for (i) fixture cases, and
(ii) fixtures defined in conftest.py files at any depth. Fixes
#311. PR
#317 by @michele-riva.See documentation page for details.
@fixture and @parametrize are now async and generator aware. Fixes #286. PR #301 by jgersti.
Added official support for Python 3.10, 3.11 and 3.12. Fixes #314
ModuleNotFoundError: distutils on Python 3.12 thanks to packaging. PR
#312 by @jayqi.See documentation page for details.
Fixed AttributeError issue in is_case_function when an inspected symbol is a parametrized type hint without __name__. Fixes #287
AttributeError issue in is_case_function when an inspected symbol is a parametrized type hint
without __name__. Fixes #287get_all_cases: default value for cases was wrong. Fixes #290See documentation page for details.
Fixed issue where a lazy value (for example a case function) was not resolved before being injected in a parametrized function, and was therefore appe
_LazyValueCaseParamValue . Fixed #274See documentation page for details.
Improved compatibility with other pytest plugins, in particular pytest-repeat, by supporting removal from fixture closure tree. Fixed #269.
pytest plugins, in particular pytest-repeat, by supporting removal from fixture closure tree. Fixed #269.pyright. Fixed #270See documentation page for details.
get_all_cases can now be called without parametrization_target (defaulting to the caller module), and with an explicit module object. Fixed #258. PR #
get_all_cases can now be called without parametrization_target (defaulting to the caller module), and with an explicit module object. Fixed #258. PR #260 by @eddiebergman.AttributeError: module 'pytest_cases' has no attribute 'CasesCollectionWarning' when running pytest-xdist and at least one cases class is ignored because of __init__ or __new__. Fixed #249.See documentation page for details.
Fixed ImportError when using pytest 7.1. Fixed #264 and pytest-dev#9762.
ImportError when using pytest 7.1. Fixed #264 and pytest-dev#9762.See documentation page for details.
Fixed FrozenInstanceError when using pytest 7.0.0. Fixed #251. PR#253 by jammer87
See documentation page for details.
Suppressed warnings in our own tests, to improve packaging maintenance. Fixed #248
ids in @parametrize without setting explicitly idgen=None would raise a ValueError. Fixed #238.Pool. Fixes #242See documentation page for details.
Improved error message when a case function nested in a class has no self argument and is not static. Fixes #243
self argument and is not static. Fixes #243__version__ in development mode.See documentation page for details.
Fixed an issue where using keyword argnames in @pytest.mark.parametrize would cause IndexError: tuple index out of range in the tests collection phase
argnames in @pytest.mark.parametrize would cause IndexError: tuple index out of range in the tests collection phase. Fixed #234.See documentation page for details.
A case id can now be a reserved keyword without triggering any SyntaxError, even if the case is transformed into a fixture. Fixes #230
SyntaxError, even if the case is transformed into a fixture. Fixes #230See documentation page for details.
Fixed an issue where a lazy value would not be resolved. This happens when the "auto-simplify fixture" happens in @parametrize. Fixes #225
@parametrize. Fixes #225See documentation page for details.
Fixed most flake8 errors and updated documentation to use genbadge. Fixes #223
flake8 errors and updated documentation to use genbadge. Fixes #223See documentation page for details.
Fixed ValueError when @parametrize is used to parametrize a class. Also, added a more explicit TypeError when @parametrize is used to parametrize a cl
ValueError when @parametrize is used to parametrize a class. Also, added a more explicit TypeError when @parametrize is used to parametrize a class and at least a fixture reference is present. Fixed #215.See documentation page for details.
The current_cases fixture now contains case parameters if any. Fixes #214
The current_cases fixture now contains case parameters if any. Fixes #214
The current_cases fixture entries are now instances of namedtuple.
New in_cls argument in unpack_fixtures so that it can be used inside classes. Fixes #201
Fixed minor issue where empty entries could be present in currentcases. Fixes #213
See documentation page for details.
Fixed issues where the currentcases fixture would not return the correct case function. Fixed #212
currentcases fixture would not return the correct case function. Fixed #212See documentation page for details.
Fixed error message related to misuse of fixture_ref. Fixes #209
fixture_ref. Fixes #209See documentation page for details.
A new helper function get_current_cases is also provided, for direct access from a hook. get_current_case_id becomes deprecated in favour of these two…
New: Users can now easily access the current cases for each parametrized argument thanks to the new current_cases fixture. A new helper function get_current_cases is also provided, for direct access from a hook. get_current_case_id becomes deprecated in favour of these two. Fixes #195
Bugfix: Fixed issue where the cache of a lazy_value used for a tuple of parameters (several argnames) was not considering the pytest context and thus was wrongly used across pytest nodes. Fixes #202
Improved error message when a fixture parametrized with several argnames as once is not able to unpack the parameter values received (non subscriptable object).
parametrize_plus and fixture_plus are now deprecated in favour of parametrize and fixture, as most users seem to have adopted these names without issues.
(internal) Replaced the "used" parameter with a dedicated singleton USED
See documentation page for details.
LazyValue, LazyTuple and LazyTupleItem are now hashable. This increases compatibility with plugins hashing the parameter values, such as pytest-steps.
LazyValue, LazyTuple and LazyTupleItem are now hashable. This increases compatibility with plugins hashing the parameter values, such as pytest-steps. See pytest-steps#41 . Fixes #199See documentation page for details.
Fixed bug when a test module containing @parametrize_with_cases was executed outside of pytest, typically through its __main__. Fixes #198
@parametrize_with_cases was executed outside of pytest, typically through its __main__. Fixes #198See documentation page for details.
Fixed issue when @parametrize_with_cases was used on a fixture in a conftest.py. Fixes #196
@parametrize_with_cases was used on a fixture in a conftest.py. Fixes #196See documentation page for details.
Technical release to check that Zenodo metadata is now preserved. Same as 3.4.2, 3.4.1 and 3.4.0.
Technical release to check that Zenodo metadata is now preserved. Same as 3.4.2, 3.4.1 and 3.4.0.
See documentation page for details.
Technical release to check that Zenodo metadata is now preserved. Same as 3.4.1 and 3.4.0.
Technical release to check that Zenodo metadata is now preserved. Same as 3.4.1 and 3.4.0.
See documentation page for details.
Technical release to check that Zenodo metadata is now preserved.
Technical release to check that Zenodo metadata is now preserved.
See documentation page for details.
Legacy v1 API was dropped. Fixes #192
Legacy v1 API was dropped. Fixes #192
Unbound case functions in a class (e.g. Foo.bar) can now be directly passed to parametrize_with_cases without instantiating the class, e.g. parametrize_with_cases(cases=Foo.bar). Fixes #159
Fixed bug with concatenation of marks on cases. Fixes #191
Fixed an issue where a case transformed into a fixture, with the same name as the fixture it requires, would lead to a pytest fixture recursion.
Fixtures in case files can now be automatically imported using the experimental @parametrize_with_cases(import_fixtures=True). Fixes #193
See documentation page for details.
Migrated to Github Actions + nox for CI/CD.
Migrated to Github Actions + nox for CI/CD.
New helper function get_current_case_id to get the current case id for a given pytest request or item. Fixes #189
Extended the support of fixture closure modifications to remove and insert(0, f). This in particular solves an issue with pytest-asyncio. Fixes #176
New filters module providing helper functions has_tag, id_has_prefix, id_has_suffix, id_match_regex to easily create custom filters for use in @parametrize_with_cases(filter=...). PR #184 by @saroad2, (thanks !).
See documentation page for details.
Fixed fixture 'self' not found issue when @fixture was used to decorate a class method not explicitly depending on request. Fixed #182
fixture 'self' not found issue when @fixture was used to decorate a class method not explicitly depending on request. Fixed #182See documentation page for details.
New: from version 3.2 on, if auto_refs=True (default), @parametrize will automatically detect fixture symbols in the list of argvalues, and will creat
New: from version 3.2 on, if auto_refs=True (default), @parametrize will automatically detect fixture symbols in the list of argvalues, and will create fixture_refs automatically around them so that you don't need to. Fixes #177
Fixed ordering issue happening on linux targets when several @parametrize are used to decorate the same function. Fixes #180
See documentation page for details.
Now appending fixtures to the closure once it has been built is supported. This fixes an issue with pytest-asyncio. Fixes #176
Now appending fixtures to the closure once it has been built is supported. This fixes an issue with pytest-asyncio. Fixes #176
Fixed issue when parametrize_with_cases was used on case functions themselves (nesting/recursion). This was due to a lack of support of the place_as magic pytest attribute. Fixes #179
Added a warning concerning usage of indirect in parametrize when fixture references are present. See #150
See documentation page for details.
Fixed issue with Empty id marker leaking to test ids. Fixed #171
See documentation page for details.
@parametrize_with_cases now by default (cases=AUTO) looks for both file naming patterns test_ _cases.py and cases_ .py. Removed the AUTO2 constant. Fi
@parametrize_with_cases now by default (cases=AUTO) looks for both file naming patterns test_<name>_cases.py and cases_<name>.py. Removed the AUTO2 constant. Fixed #140
Nested classes containing case functions are now officially supported (they were, but undocumented). Fixed #160
Case functions that are staticmethod and classmethod are now supported as well. Fixes #168
See documentation page for details.
Major refactoring of the way ids and marks are generated and customized in fixture_union, @parametrize and @parametrize_with_cases. Now idstyle has a
Major refactoring of the way ids and marks are generated and customized in fixture_union, @parametrize and @parametrize_with_cases. Now idstyle has a consistent behaviour across the board, ids and idstyle can work together correctly, @parametrize_with_cases and @parametrize have much better default values for ids, and many others. See documentation for details. Fixed #154
New public API to manipulate information about a case function: copy_case_info, set_case_id, get_case_id, get_case_marks, get_case_tags, matches_tag_query, is_case_class, is_case_function. See API reference.
Fixed default behaviour of idgen in @parametrize: it only defaults to AUTO when no fixture_ref are used in the argvalues.
See documentation page for details.
Fixed AttributeError: 'DoctestItem' object has no attribute '_request' when executing doctests. Fixes #156
AttributeError: 'DoctestItem' object has no attribute '_request' when executing doctests. Fixes #156See documentation page for details.
@pytest.mark.usefixtures can be now be used on case functions. Fixes #152.
@pytest.mark.usefixtures can be now be used on case functions. Fixes #152.See documentation page for details.
lazy_value parameters are now cached by pytest node id only. So plugins can access the value without triggering an extra function call, but a new call
lazy_value parameters are now cached by pytest node id only. So plugins can access the value without triggering an extra function call, but a new call is triggered for each pytest node, so as to prevent mutable object leakage across tests. Fixed #149 while ensuring no regression for #143.
The ids argument of parametrize now accepts a (possibly infinite) generator of ids, e.g. (f"foo{i}" for i in itertools.count()), just as pytest does. This was not always the case, inparticular when parametrizing a @fixture. The ids arguments of fixture_union, param_fixture[s], etc. now also support this pattern. Fixed #148
See documentation page for details.
Improved description for the glob argument in @parametrize_with_cases. Also made the implementation escape all regex special characters so that they c
glob argument in @parametrize_with_cases. Also made the implementation escape all regex special characters so that they can't be used. Finally a pattern should now match the entire case id (previously, a partial match would work if it was at the beginning of the string). One step towards #147See documentation page for details.
is_lazy is now part of public API, and _LazyValue now has a cache mechanism like _LazyTuple. Fixes #143
is_lazy is now part of public API, and _LazyValue now has a cache mechanism like _LazyTuple. Fixes #143
@parametrize: custom ids are now correctly taken into account when a single lazy_valueis used for a tuple of parameters. This issue could be seen also with @parametrize_with_cases: idgen does not seem to be taken into account when cases are unpacked into a tuple. Fixes #144.
Empty case ids are now replaced with '<empty_case_id>' to avoid ambiguous interpretation of test ids. Fixes #142.
See documentation page for details.
new clone(self, remove_int_base=False) API on LazyValue and LazyTupleItem instances. With this new API, on old pytest < 5.3, other plugins such as pyt
clone(self, remove_int_base=False) API on LazyValue and LazyTupleItem instances. With this new API, on old pytest < 5.3, other plugins such as pytest-harvest can easily clone the contents from lazy values without having them inherit from int - which was a dirty hack used by pytest-cases to trick pytest to generate acceptable test ids in these old pytest versions. Also improved the LazyValue, LazyTuple and LazyTupleItem object model with equality and repr. Fixes pytest-harvest#43See documentation page for details.
Marks set on a case class are now propagated to cases in the class. So you can use for example `pytest-pilot` more easily ! Fixes #139
pytest-pilot more easily ! Fixes #139See documentation page for details.
Fixed "Created fixture names are not unique, please report" error when duplicate fixture reference is provided in a pytest.param. Fixes #138.
See documentation page for details.
Fixed TypeError: _idval() got an unexpected keyword argument 'item' with pytest versions between 3.0.0 and 3.7.4. Fixed #136
TypeError: _idval() got an unexpected keyword argument 'item' with pytest versions between 3.0.0 and 3.7.4. Fixed #136See documentation page for details.
@parametrize_with_cases now supports that argnames is a list or tuple, just as @pytest.mark.parametrize does. PR #132, by `@saroad2`.
@parametrize_with_cases now supports that argnames is a list or tuple, just as @pytest.mark.parametrize does. PR #132, by @saroad2.See documentation page for details.
Now enforcing usage of makefun 1.9.3 or above to avoid issue AttributeError: 'functools.partial' object has no attribute '__module__' mentioned in #12
makefun 1.9.3 or above to avoid issue AttributeError: 'functools.partial' object has no attribute '__module__' mentioned in #128See documentation page for details.
Improved documentation to explain why @fixture should be used instead of @pytest.fixture. Fixed #125
Improved documentation to explain why @fixture should be used instead of @pytest.fixture. Fixed #125
Fixed ValueError: fixture is being applied more than once to the same function when two functions parametrized with the same cases were sitting in the same file. Improved robustness when cases require fixtures, in particular when parametrized test/fixture sits in a class or when several of them sit in a class/module. Fixed #126
See documentation page for details.
Added missing deprecation warning on @cases_generator. Fixes #124.
Added missing deprecation warning on @cases_generator. Fixes #124.
Removed target and tags arguments of @cases_generator (deprecated api anyway) that were added by mistake in version 2.0.0 but never used.
See documentation page for details.
Added support for pytest items without funcargs. Fixes interoperability with other pytest plugins such as pytest-black or pytest-flake8. Fixes #122
pytest-black or pytest-flake8. Fixes #122See documentation page for details.
pytest 6 is now supported. Fixes #121
pytest 6 is now supported. Fixes #121
Fixed issue with @parametrize_with_cases when two cases with the same id and both requiring a fixture were to be created. Fixed #117.
Fixed issue with @parametrize_with_cases when two cases with the same id and both requiring a fixture were to be created. Fixed #117.
Fixture closure engine refactoring:
When no fixture unions are present, the fixture closure is now identical to the default one in pytest, to avoid issues originating from other plugins fiddling with the closure. Fixes #116
New SuperClosure class representing the "list" facade on top of the fixture tree (instead of FixtureClosureNode). In addition, this list facade now better handles editing the order of fixtures when possible. Fixes #111.
Session and Module-scoped fixtures that are not used in all union alternatives are not any more torn town/setup across union alternatives. Fixes #120
See documentation page for details.
Fixed TypeError with iterable argvalue in standard parametrize. Fixed #115.
TypeError with iterable argvalue in standard parametrize. Fixed #115.See documentation page for details.
Your coding agent can read these notes before it upgrades. Set up the MCP server →