Separate test code from test cases in pytest.
BSD-3-CLAUSE License
Bot releases are hidden (Show)
Published by smarie over 3 years ago
fixture 'self' not found
issue when @fixture
was used to decorate a class method not explicitly depending on request
. Fixed #182
See documentation page for details.
Published by smarie almost 4 years ago
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_ref
s 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.
Published by smarie almost 4 years ago
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.
Published by smarie almost 4 years ago
See documentation page for details.
Published by smarie almost 4 years ago
@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.
Published by smarie almost 4 years ago
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.
Published by smarie almost 4 years ago
AttributeError: 'DoctestItem' object has no attribute '_request'
when executing doctests. Fixes #156
See documentation page for details.
Published by smarie almost 4 years ago
@pytest.mark.usefixtures
can be now be used on case functions. Fixes #152.See documentation page for details.
Published by smarie almost 4 years ago
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.
Published by smarie almost 4 years ago
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 #147
See documentation page for details.
Published by smarie almost 4 years ago
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_value
is 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.
Published by smarie about 4 years ago
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#43
See documentation page for details.
Published by smarie about 4 years ago
pytest-pilot
more easily ! Fixes #139
See documentation page for details.
Published by smarie about 4 years ago
See documentation page for details.
Published by smarie about 4 years ago
TypeError: _idval() got an unexpected keyword argument 'item'
with pytest
versions between 3.0.0 and 3.7.4. Fixed #136
See documentation page for details.
Published by smarie about 4 years ago
@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.
Published by smarie about 4 years ago
makefun
1.9.3 or above to avoid issue AttributeError: 'functools.partial' object has no attribute '__module__'
mentioned in #128
See documentation page for details.
Published by smarie about 4 years ago
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.
Published by smarie about 4 years ago
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.
Published by smarie about 4 years ago
pytest-black
or pytest-flake8
. Fixes #122
See documentation page for details.