2012-10-19 16:07:11 +08:00
|
|
|
pytest-2.3: improved fixtures / better unittest integration
|
2012-10-18 18:24:50 +08:00
|
|
|
=============================================================================
|
|
|
|
|
2018-05-18 16:19:46 +08:00
|
|
|
pytest-2.3 comes with many major improvements for fixture/funcarg management
|
2012-10-19 16:07:11 +08:00
|
|
|
and parametrized testing in Python. It is now easier, more efficient and
|
|
|
|
more predicatable to re-run the same tests with different fixture
|
|
|
|
instances. Also, you can directly declare the caching "scope" of
|
|
|
|
fixtures so that dependent tests throughout your whole test suite can
|
|
|
|
re-use database or other expensive fixture objects with ease. Lastly,
|
|
|
|
it's possible for fixture functions (formerly known as funcarg
|
|
|
|
factories) to use other fixtures, allowing for a completely modular and
|
2018-05-18 16:19:46 +08:00
|
|
|
re-useable fixture design.
|
2012-10-19 16:07:11 +08:00
|
|
|
|
|
|
|
For detailed info and tutorial-style examples, see:
|
2012-10-18 18:24:50 +08:00
|
|
|
|
2012-10-19 16:53:28 +08:00
|
|
|
http://pytest.org/latest/fixture.html
|
2012-10-18 18:24:50 +08:00
|
|
|
|
2012-10-19 16:07:11 +08:00
|
|
|
Moreover, there is now support for using pytest fixtures/funcargs with
|
|
|
|
unittest-style suites, see here for examples:
|
2012-10-18 18:24:50 +08:00
|
|
|
|
2012-10-19 16:53:28 +08:00
|
|
|
http://pytest.org/latest/unittest.html
|
2012-10-18 18:24:50 +08:00
|
|
|
|
2012-10-19 16:07:11 +08:00
|
|
|
Besides, more unittest-test suites are now expected to "simply work"
|
|
|
|
with pytest.
|
|
|
|
|
|
|
|
All changes are backward compatible and you should be able to continue
|
|
|
|
to run your test suites and 3rd party plugins that worked with
|
|
|
|
pytest-2.2.4.
|
|
|
|
|
2018-05-18 16:19:46 +08:00
|
|
|
If you are interested in the precise reasoning (including examples) of the
|
2012-10-19 17:12:13 +08:00
|
|
|
pytest-2.3 fixture evolution, please consult
|
|
|
|
http://pytest.org/latest/funcarg_compare.html
|
2012-10-18 18:24:50 +08:00
|
|
|
|
|
|
|
For general info on installation and getting started:
|
|
|
|
|
2012-10-19 16:53:28 +08:00
|
|
|
http://pytest.org/latest/getting-started.html
|
2012-10-18 18:24:50 +08:00
|
|
|
|
|
|
|
Docs and PDF access as usual at:
|
|
|
|
|
|
|
|
http://pytest.org
|
|
|
|
|
|
|
|
and more details for those already in the knowing of pytest can be found
|
|
|
|
in the CHANGELOG below.
|
|
|
|
|
|
|
|
Particular thanks for this release go to Floris Bruynooghe, Alex Okrushko
|
2018-05-18 16:19:46 +08:00
|
|
|
Carl Meyer, Ronny Pfannschmidt, Benjamin Peterson and Alex Gaynor for helping
|
2012-10-18 18:24:50 +08:00
|
|
|
to get the new features right and well integrated. Ronny and Floris
|
|
|
|
also helped to fix a number of bugs and yet more people helped by
|
|
|
|
providing bug reports.
|
|
|
|
|
|
|
|
have fun,
|
|
|
|
holger krekel
|
|
|
|
|
|
|
|
|
2012-10-19 16:53:28 +08:00
|
|
|
Changes between 2.2.4 and 2.3.0
|
2012-10-19 16:07:11 +08:00
|
|
|
-----------------------------------
|
|
|
|
|
2012-10-19 16:53:28 +08:00
|
|
|
- fix issue202 - better automatic names for parametrized test functions
|
2012-10-19 16:07:11 +08:00
|
|
|
- fix issue139 - introduce @pytest.fixture which allows direct scoping
|
|
|
|
and parametrization of funcarg factories. Introduce new @pytest.setup
|
|
|
|
marker to allow the writing of setup functions which accept funcargs.
|
|
|
|
- fix issue198 - conftest fixtures were not found on windows32 in some
|
|
|
|
circumstances with nested directory structures due to path manipulation issues
|
|
|
|
- fix issue193 skip test functions with were parametrized with empty
|
|
|
|
parameter sets
|
|
|
|
- fix python3.3 compat, mostly reporting bits that previously depended
|
|
|
|
on dict ordering
|
|
|
|
- introduce re-ordering of tests by resource and parametrization setup
|
|
|
|
which takes precedence to the usual file-ordering
|
|
|
|
- fix issue185 monkeypatching time.time does not cause pytest to fail
|
|
|
|
- fix issue172 duplicate call of pytest.setup-decoratored setup_module
|
|
|
|
functions
|
|
|
|
- fix junitxml=path construction so that if tests change the
|
|
|
|
current working directory and the path is a relative path
|
|
|
|
it is constructed correctly from the original current working dir.
|
|
|
|
- fix "python setup.py test" example to cause a proper "errno" return
|
|
|
|
- fix issue165 - fix broken doc links and mention stackoverflow for FAQ
|
|
|
|
- catch unicode-issues when writing failure representations
|
|
|
|
to terminal to prevent the whole session from crashing
|
|
|
|
- fix xfail/skip confusion: a skip-mark or an imperative pytest.skip
|
|
|
|
will now take precedence before xfail-markers because we
|
|
|
|
can't determine xfail/xpass status in case of a skip. see also:
|
|
|
|
http://stackoverflow.com/questions/11105828/in-py-test-when-i-explicitly-skip-a-test-that-is-marked-as-xfail-how-can-i-get
|
|
|
|
|
|
|
|
- always report installed 3rd party plugins in the header of a test run
|
|
|
|
|
|
|
|
- fix issue160: a failing setup of an xfail-marked tests should
|
|
|
|
be reported as xfail (not xpass)
|
|
|
|
|
|
|
|
- fix issue128: show captured output when capsys/capfd are used
|
|
|
|
|
2017-01-01 01:54:47 +08:00
|
|
|
- fix issue179: properly show the dependency chain of factories
|
2012-10-19 16:07:11 +08:00
|
|
|
|
|
|
|
- pluginmanager.register(...) now raises ValueError if the
|
|
|
|
plugin has been already registered or the name is taken
|
|
|
|
|
2018-05-18 16:19:46 +08:00
|
|
|
- fix issue159: improve http://pytest.org/latest/faq.html
|
2012-10-19 16:07:11 +08:00
|
|
|
especially with respect to the "magic" history, also mention
|
|
|
|
pytest-django, trial and unittest integration.
|
|
|
|
|
|
|
|
- make request.keywords and node.keywords writable. All descendant
|
|
|
|
collection nodes will see keyword values. Keywords are dictionaries
|
|
|
|
containing markers and other info.
|
|
|
|
|
|
|
|
- fix issue 178: xml binary escapes are now wrapped in py.xml.raw
|
|
|
|
|
|
|
|
- fix issue 176: correctly catch the builtin AssertionError
|
|
|
|
even when we replaced AssertionError with a subclass on the
|
|
|
|
python level
|
|
|
|
|
|
|
|
- factory discovery no longer fails with magic global callables
|
|
|
|
that provide no sane __code__ object (mock.call for example)
|
|
|
|
|
|
|
|
- fix issue 182: testdir.inprocess_run now considers passed plugins
|
|
|
|
|
|
|
|
- fix issue 188: ensure sys.exc_info is clear on python2
|
|
|
|
before calling into a test
|
|
|
|
|
|
|
|
- fix issue 191: add unittest TestCase runTest method support
|
|
|
|
- fix issue 156: monkeypatch correctly handles class level descriptors
|
|
|
|
|
|
|
|
- reporting refinements:
|
|
|
|
|
|
|
|
- pytest_report_header now receives a "startdir" so that
|
|
|
|
you can use startdir.bestrelpath(yourpath) to show
|
|
|
|
nice relative path
|
|
|
|
|
2018-05-18 16:19:46 +08:00
|
|
|
- allow plugins to implement both pytest_report_header and
|
2012-10-19 16:07:11 +08:00
|
|
|
pytest_sessionstart (sessionstart is invoked first).
|
|
|
|
|
|
|
|
- don't show deselected reason line if there is none
|
|
|
|
|
2017-01-01 01:54:47 +08:00
|
|
|
- py.test -vv will show all of assert comparisons instead of truncating
|