test_ok2/doc/announce/release-2.0.0.txt

163 lines
6.9 KiB
Plaintext
Raw Normal View History

2010-11-19 01:42:33 +08:00
py.test 2.0.0: improved asserts, unittest, reporting, config, docs
===========================================================================
2010-11-19 01:42:33 +08:00
Welcome to pytest-2.0.0, a major new release of "py.test", the rapid
easy Python testing tool. There are many new features and a lot of
long-deprecated code is removed, resulting in a much smaller and cleaner
implementation. If you had a test suite using non-deprecated
functionality 2.0.0 is very likely to continue to work for you without
requiring changes.
2010-11-19 01:42:33 +08:00
Check out the revised the improved documentation and examples:
2010-11-19 01:42:33 +08:00
http://pytest.org/2.0.0/index.html
Thanks to all issue reporters and people asking questions or
complaining. Particular thanks to Floris Bruynooghe and Ronny Pfannschmidt
2010-11-19 01:42:33 +08:00
for their great coding contributions and may others for feedback and help.
best,
2010-11-19 01:42:33 +08:00
holger krekel
New Features
-----------------------
- new invocations through Python interpreter and from Python::
python -m pytest # on all pythons >= 2.5
or from a python program::
2010-11-19 01:42:33 +08:00
import pytest ; pytest.main(arglist, pluginlist)
see http://pytest.org/2.0.0/usage.html for details.
- new and better reporting information in assert expressions
if comparing lists, sequences or strings.
see http://pytest.org/2.0.0/assert.html for details.
- new configuration through ini-files (setup.cfg or tox.ini recognized),
for example::
[pytest]
norecursedirs = .hg data* # don't ever recurse in such dirs
addopts = -x --pyargs # add these command line options by default
see http://pytest.org/2.0.0/customize.html
2010-11-19 01:42:33 +08:00
- improved standard unittest support. In general py.test should now
better run custom TestCases like twisted trial or Django based
TestCases. Also you can now run the tests of an installed
'unittest' package with py.test::
py.test --pyargs unittest
- new "-q" option which decreases verbosity and prints a more
nose/unittest-style "dot" output.
2010-11-19 01:42:33 +08:00
- many more improvements in details
Fixes
-----------------------
- fix issue126 - introduce py.test.set_trace() to trace execution via
PDB during the running of tests even if capturing is ongoing.
- fix issue124 - make reporting more resilient against tests opening
files on filedescriptor 1 (stdout).
- fix issue109 - sibling conftest.py files will not be loaded.
(and Directory collectors cannot be customized anymore from a Directory's
conftest.py - this needs to happen at least one level up).
- fix issue88 (finding custom test nodes from command line arg)
- fix issue93 stdout/stderr is captured while importing conftest.py
- fix bug: unittest collected functions now also can have "pytestmark"
applied at class/module level
2010-11-19 01:42:33 +08:00
Notes
--------------------
* The usual way in pre-2.0 times to use py.test in python code was
to import "py" and then e.g. use "py.test.raises" for the helper.
This remains valid and is not planned to be deprecated. However,
in most examples and internal code you'll find "import pytest"
and "pytest.raises" used as the recommended default way.
* pytest now first performs collection of the complete test suite
before running any test. This changes for example the semantics of when
pytest_collectstart/pytest_collectreport are called. Some plugins may
need upgrading.
2010-11-19 01:42:33 +08:00
* The pytest package consists of a 400 LOC core.py and about 20 builtin plugins,
summing up to roughly 5000 LOCs, including docstrings. To be fair, it also
uses generic code from the "pylib", and the new "py" package to help
with filesystem and introspection/code manipulation.
(Incompatible) Removals
-----------------------------
- py.test.config is now only available if you are in a test run.
- the following (mostly already deprecated) functionality was removed:
- removed support for Module/Class/... collection node definitions
in conftest.py files. They will cause nothing special.
- removed support for calling the pre-1.0 collection API of "run()" and "join"
- removed reading option values from conftest.py files or env variables.
This can now be done much much better and easier through the ini-file
mechanism and the "addopts" entry in particular.
- removed the "disabled" attribute in test classes. Use the skipping
and pytestmark mechanism to skip or xfail a test class.
- py.test.collect.Directory does not exist anymore and it
is not possible to provide an own "Directory" object.
2010-11-19 01:42:33 +08:00
If you have used this and don't know what to do, get
in contact. We'll figure someting out.
Note that pytest_collect_directory() is still called but
any return value will be ignored. This allows to keep
old code working that performed for example "py.test.skip()"
in collect() to prevent recursion into directory trees
if a certain dependency or command line option is missing.
More Detailed Changes between 1.3.4 and 2.0.0
==================================================
- pytest-2.0 is now its own package and depends on pylib-2.0
- new ability: python -m pytest / python -m pytest.main ability
- new python invcation: pytest.main(args, plugins) to load
some custom plugins early.
- try harder to run unittest test suites in a more compatible manner
by deferring setup/teardown semantics to the unittest package.
- introduce a new way to set config options via ini-style files,
by default setup.cfg and tox.ini files are searched. The old
ways (certain environment variables, dynamic conftest.py reading
is removed).
- add a new "-q" option which decreases verbosity and prints a more
nose/unittest-style "dot" output.
- fix issue126 - introduce py.test.set_trace() to trace execution via
PDB during the running of tests even if capturing is ongoing.
- fix issue123 - new "python -m py.test" invocation for py.test
(requires Python 2.5 or above)
- fix issue124 - make reporting more resilient against tests opening
files on filedescriptor 1 (stdout).
- fix issue109 - sibling conftest.py files will not be loaded.
(and Directory collectors cannot be customized anymore from a Directory's
conftest.py - this needs to happen at least one level up).
- introduce (customizable) assertion failure representations and enhance
output on assertion failures for comparisons and other cases (Floris Bruynooghe)
- nose-plugin: pass through type-signature failures in setup/teardown
functions instead of not calling them (Ed Singleton)
- remove py.test.collect.Directory (follows from a major refactoring
and simplification of the collection process)
- majorly reduce py.test core code, shift function/python testing to own plugin
- fix issue88 (finding custom test nodes from command line arg)
- refine 'tmpdir' creation, will now create basenames better associated
with test names (thanks Ronny)
- "xpass" (unexpected pass) tests don't cause exitcode!=0
- fix issue131 / issue60 - importing doctests in __init__ files used as namespace packages
- fix issue93 stdout/stderr is captured while importing conftest.py
- fix bug: unittest collected functions now also can have "pytestmark"
applied at class/module level