Debian Codegraph @

testing/web-platform/tests/tools/third_party/pytest/doc/en/announce/release-2.0.0.rst

raw
1 py.test 2.0.0: asserts++, unittest++, reporting++, config++, docs++
2 ===========================================================================
3
4 Welcome to pytest-2.0.0, a major new release of "py.test", the rapid
5 easy Python testing tool. There are many new features and enhancements,
6 see below for summary and detailed lists. A lot of long-deprecated code
7 has been removed, resulting in a much smaller and cleaner
8 implementation. See the new docs with examples here:
9
10 http://pytest.org/en/stable/index.html
11
12 A note on packaging: pytest used to part of the "py" distribution up
13 until version py-1.3.4 but this has changed now: pytest-2.0.0 only
14 contains py.test related code and is expected to be backward-compatible
15 to existing test code. If you want to install pytest, just type one of::
16
17 pip install -U pytest
18 easy_install -U pytest
19
20 Many thanks to all issue reporters and people asking questions or
21 complaining. Particular thanks to Floris Bruynooghe and Ronny Pfannschmidt
22 for their great coding contributions and many others for feedback and help.
23
24 best,
25 holger krekel
26
27
28 New Features
29 -----------------------
30
31 - new invocations through Python interpreter and from Python::
32
33 python -m pytest # on all pythons >= 2.5
34
35 or from a python program::
36
37 import pytest ; pytest.main(arglist, pluginlist)
38
39 see http://pytest.org/en/stable/how-to/usage.html for details.
40
41 - new and better reporting information in assert expressions
42 if comparing lists, sequences or strings.
43
44 see http://pytest.org/en/stable/how-to/assert.html#newreport
45
46 - new configuration through ini-files (setup.cfg or tox.ini recognized),
47 for example::
48
49 [pytest]
50 norecursedirs = .hg data* # don't ever recurse in such dirs
51 addopts = -x --pyargs # add these command line options by default
52
53 see http://pytest.org/en/stable/reference/customize.html
54
55 - improved standard unittest support. In general py.test should now
56 better be able to run custom unittest.TestCases like twisted trial
57 or Django based TestCases. Also you can now run the tests of an
58 installed 'unittest' package with py.test::
59
60 py.test --pyargs unittest
61
62 - new "-q" option which decreases verbosity and prints a more
63 nose/unittest-style "dot" output.
64
65 - many, many, more detailed improvements details
66
67 Fixes
68 -----------------------
69
70 - fix issue126 - introduce py.test.set_trace() to trace execution via
71 PDB during the running of tests even if capturing is ongoing.
72 - fix issue124 - make reporting more resilient against tests opening
73 files on filedescriptor 1 (stdout).
74 - fix issue109 - sibling conftest.py files will not be loaded.
75 (and Directory collectors cannot be customized anymore from a Directory's
76 conftest.py - this needs to happen at least one level up).
77 - fix issue88 (finding custom test nodes from command line arg)
78 - fix issue93 stdout/stderr is captured while importing conftest.py
79 - fix bug: unittest collected functions now also can have "pytestmark"
80 applied at class/module level
81
82 Important Notes
83 --------------------
84
85 * The usual way in pre-2.0 times to use py.test in python code was
86 to import "py" and then e.g. use "py.test.raises" for the helper.
87 This remains valid and is not planned to be deprecated. However,
88 in most examples and internal code you'll find "import pytest"
89 and "pytest.raises" used as the recommended default way.
90
91 * pytest now first performs collection of the complete test suite
92 before running any test. This changes for example the semantics of when
93 pytest_collectstart/pytest_collectreport are called. Some plugins may
94 need upgrading.
95
96 * The pytest package consists of a 400 LOC core.py and about 20 builtin plugins,
97 summing up to roughly 5000 LOCs, including docstrings. To be fair, it also
98 uses generic code from the "pylib", and the new "py" package to help
99 with filesystem and introspection/code manipulation.
100
101 (Incompatible) Removals
102 -----------------------------
103
104 - py.test.config is now only available if you are in a test run.
105
106 - the following (mostly already deprecated) functionality was removed:
107
108 - removed support for Module/Class/... collection node definitions
109 in conftest.py files. They will cause nothing special.
110 - removed support for calling the pre-1.0 collection API of "run()" and "join"
111 - removed reading option values from conftest.py files or env variables.
112 This can now be done much, much, better and easier through the ini-file
113 mechanism and the "addopts" entry in particular.
114 - removed the "disabled" attribute in test classes. Use the skipping
115 and pytestmark mechanism to skip or xfail a test class.
116
117 - py.test.collect.Directory does not exist anymore and it
118 is not possible to provide an own "Directory" object.
119 If you have used this and don't know what to do, get
120 in contact. We'll figure something out.
121
122 Note that pytest_collect_directory() is still called but
123 any return value will be ignored. This allows to keep
124 old code working that performed for example "py.test.skip()"
125 in collect() to prevent recursion into directory trees
126 if a certain dependency or command line option is missing.
127
128
129 see :ref:`changelog` for more detailed changes.