2011-11-19 00:01:29 +08:00
|
|
|
py.test 2.2.0: test marking++, parametrization++ and duration profiling
|
2011-11-09 01:20:56 +08:00
|
|
|
===========================================================================
|
|
|
|
|
2011-11-19 00:01:29 +08:00
|
|
|
pytest-2.2.0 is a test-suite compatible release of the popular
|
2011-12-05 18:10:48 +08:00
|
|
|
py.test testing tool. Plugins might need upgrades. It comes
|
2011-11-19 02:32:11 +08:00
|
|
|
with these improvements:
|
2011-11-12 23:10:12 +08:00
|
|
|
|
2011-11-19 02:45:15 +08:00
|
|
|
* easier and more powerful parametrization of tests:
|
2011-11-12 23:10:12 +08:00
|
|
|
|
2011-11-19 02:45:15 +08:00
|
|
|
- new @pytest.mark.parametrize decorator to run tests with different arguments
|
2011-11-19 02:32:11 +08:00
|
|
|
- new metafunc.parametrize() API for parametrizing arguments independently
|
2019-08-28 03:00:48 +08:00
|
|
|
- see examples at http://pytest.org/en/latest/example/parametrize.html
|
2011-11-19 02:32:11 +08:00
|
|
|
- NOTE that parametrize() related APIs are still a bit experimental
|
|
|
|
and might change in future releases.
|
2011-11-12 23:10:12 +08:00
|
|
|
|
2011-11-19 02:32:11 +08:00
|
|
|
* improved handling of test markers and refined marking mechanism:
|
2011-11-12 23:10:12 +08:00
|
|
|
|
2011-11-19 02:32:11 +08:00
|
|
|
- "-m markexpr" option for selecting tests according to their mark
|
|
|
|
- a new "markers" ini-variable for registering test markers for your project
|
|
|
|
- the new "--strict" bails out with an error if using unregistered markers.
|
2019-08-28 03:00:48 +08:00
|
|
|
- see examples at http://pytest.org/en/latest/example/markers.html
|
2011-11-19 00:01:29 +08:00
|
|
|
|
2011-12-05 18:10:48 +08:00
|
|
|
* duration profiling: new "--duration=N" option showing the N slowest test
|
2011-11-19 02:32:11 +08:00
|
|
|
execution or setup/teardown calls. This is most useful if you want to
|
|
|
|
find out where your slowest test code is.
|
2011-11-19 00:01:29 +08:00
|
|
|
|
2011-12-05 18:10:48 +08:00
|
|
|
* also 2.2.0 performs more eager calling of teardown/finalizers functions
|
2011-11-19 02:32:11 +08:00
|
|
|
resulting in better and more accurate reporting when they fail
|
2011-11-12 23:10:12 +08:00
|
|
|
|
|
|
|
Besides there is the usual set of bug fixes along with a cleanup of
|
|
|
|
pytest's own test suite allowing it to run on a wider range of environments.
|
2011-11-09 01:20:56 +08:00
|
|
|
|
|
|
|
For general information, see extensive docs with examples here:
|
|
|
|
|
|
|
|
http://pytest.org/
|
|
|
|
|
|
|
|
If you want to install or upgrade pytest you might just type::
|
|
|
|
|
|
|
|
pip install -U pytest # or
|
|
|
|
easy_install -U pytest
|
|
|
|
|
2011-11-19 03:16:00 +08:00
|
|
|
Thanks to Ronny Pfannschmidt, David Burns, Jeff Donner, Daniel Nouri, Alfredo Deza and all who gave feedback or sent bug reports.
|
2011-11-17 19:09:21 +08:00
|
|
|
|
|
|
|
best,
|
|
|
|
holger krekel
|
|
|
|
|
2011-11-12 23:10:12 +08:00
|
|
|
|
2011-11-19 00:01:29 +08:00
|
|
|
notes on incompatibility
|
2011-11-17 19:09:21 +08:00
|
|
|
------------------------------
|
2011-11-09 01:53:46 +08:00
|
|
|
|
2011-11-19 00:01:29 +08:00
|
|
|
While test suites should work unchanged you might need to upgrade plugins:
|
|
|
|
|
2011-12-05 18:10:48 +08:00
|
|
|
* You need a new version of the pytest-xdist plugin (1.7) for distributing
|
|
|
|
test runs.
|
2011-11-09 01:53:46 +08:00
|
|
|
|
2011-11-12 23:10:12 +08:00
|
|
|
* Other plugins might need an upgrade if they implement
|
2011-11-09 01:53:46 +08:00
|
|
|
the ``pytest_runtest_logreport`` hook which now is called unconditionally
|
2011-11-19 02:32:11 +08:00
|
|
|
for the setup/teardown fixture phases of a test. You may choose to
|
|
|
|
ignore setup/teardown failures by inserting "if rep.when != 'call': return"
|
2011-12-05 18:10:48 +08:00
|
|
|
or something similar. Note that most code probably "just" works because
|
2011-11-19 02:32:11 +08:00
|
|
|
the hook was already called for failing setup/teardown phases of a test
|
|
|
|
so a plugin should have been ready to grok such reports already.
|
|
|
|
|
|
|
|
|
|
|
|
Changes between 2.1.3 and 2.2.0
|
|
|
|
----------------------------------------
|
|
|
|
|
|
|
|
- fix issue90: introduce eager tearing down of test items so that
|
|
|
|
teardown function are called earlier.
|
2011-12-05 18:10:48 +08:00
|
|
|
- add an all-powerful metafunc.parametrize function which allows to
|
2011-11-19 02:32:11 +08:00
|
|
|
parametrize test function arguments in multiple steps and therefore
|
2011-12-05 18:10:48 +08:00
|
|
|
from independent plugins and places.
|
2011-11-19 02:32:11 +08:00
|
|
|
- add a @pytest.mark.parametrize helper which allows to easily
|
2011-12-05 18:10:48 +08:00
|
|
|
call a test function with different argument values.
|
|
|
|
- Add examples to the "parametrize" example page, including a quick port
|
2011-11-19 02:32:11 +08:00
|
|
|
of Test scenarios and the new parametrize function and decorator.
|
|
|
|
- introduce registration for "pytest.mark.*" helpers via ini-files
|
2011-12-05 18:10:48 +08:00
|
|
|
or through plugin hooks. Also introduce a "--strict" option which
|
2011-11-19 02:32:11 +08:00
|
|
|
will treat unregistered markers as errors
|
|
|
|
allowing to avoid typos and maintain a well described set of markers
|
2019-08-28 03:00:48 +08:00
|
|
|
for your test suite. See examples at http://pytest.org/en/latest/mark.html
|
2011-11-19 02:32:11 +08:00
|
|
|
and its links.
|
|
|
|
- issue50: introduce "-m marker" option to select tests based on markers
|
2011-12-05 18:10:48 +08:00
|
|
|
(this is a stricter and more predictable version of "-k" in that "-m"
|
2011-11-19 02:32:11 +08:00
|
|
|
only matches complete markers and has more obvious rules for and/or
|
|
|
|
semantics.
|
2011-12-05 18:10:48 +08:00
|
|
|
- new feature to help optimizing the speed of your tests:
|
|
|
|
--durations=N option for displaying N slowest test calls
|
2011-11-19 02:32:11 +08:00
|
|
|
and setup/teardown methods.
|
|
|
|
- fix issue87: --pastebin now works with python3
|
|
|
|
- fix issue89: --pdb with unexpected exceptions in doctest work more sensibly
|
2011-12-05 18:10:48 +08:00
|
|
|
- fix and cleanup pytest's own test suite to not leak FDs
|
2011-11-19 02:32:11 +08:00
|
|
|
- fix issue83: link to generated funcarg list
|
|
|
|
- fix issue74: pyarg module names are now checked against imp.find_module false positives
|
|
|
|
- fix compatibility with twisted/trial-11.1.0 use cases
|