Skip to content

Commit 9d297c0

Browse files
committed
Preparing release version 4.1.0
1 parent 0da5531 commit 9d297c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+393
-266
lines changed

CHANGELOG.rst

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,232 @@ with advance notice in the **Deprecations** section of releases.
1818
1919
.. towncrier release notes start
2020
21+
pytest 4.1.0 (2019-01-05)
22+
=========================
23+
24+
Removals
25+
--------
26+
27+
- `#2169 <https://github.com/pytest-dev/pytest/issues/2169>`_: ``pytest.mark.parametrize``: in previous versions, errors raised by id functions were suppressed and changed into warnings. Now the exceptions are propagated, along with a pytest message informing the node, parameter value and index where the exception occurred.
28+
29+
30+
- `#3078 <https://github.com/pytest-dev/pytest/issues/3078>`_: Remove legacy internal warnings system: ``config.warn``, ``Node.warn``. The ``pytest_logwarning`` now issues a warning when implemented.
31+
32+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#config-warn-and-node-warn>`__ on information on how to update your code.
33+
34+
35+
- `#3079 <https://github.com/pytest-dev/pytest/issues/3079>`_: Removed support for yield tests - they are fundamentally broken because they don't support fixtures properly since collection and test execution were separated.
36+
37+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#yield-tests>`__ on information on how to update your code.
38+
39+
40+
- `#3082 <https://github.com/pytest-dev/pytest/issues/3082>`_: Removed support for applying marks directly to values in ``@pytest.mark.parametrize``. Use ``pytest.param`` instead.
41+
42+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#marks-in-pytest-mark-parametrize>`__ on information on how to update your code.
43+
44+
45+
- `#3083 <https://github.com/pytest-dev/pytest/issues/3083>`_: Removed ``Metafunc.addcall``. This was the predecessor mechanism to ``@pytest.mark.parametrize``.
46+
47+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#metafunc-addcall>`__ on information on how to update your code.
48+
49+
50+
- `#3085 <https://github.com/pytest-dev/pytest/issues/3085>`_: Removed support for passing strings to ``pytest.main``. Now, always pass a list of strings instead.
51+
52+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#passing-command-line-string-to-pytest-main>`__ on information on how to update your code.
53+
54+
55+
- `#3086 <https://github.com/pytest-dev/pytest/issues/3086>`_: ``[pytest]`` section in **setup.cfg** files is not longer supported, use ``[tool:pytest]`` instead. ``setup.cfg`` files
56+
are meant for use with ``distutils``, and a section named ``pytest`` has notoriously been a source of conflicts and bugs.
57+
58+
Note that for **pytest.ini** and **tox.ini** files the section remains ``[pytest]``.
59+
60+
61+
- `#3616 <https://github.com/pytest-dev/pytest/issues/3616>`_: Removed the deprecated compat properties for ``node.Class/Function/Module`` - use ``pytest.Class/Function/Module`` now.
62+
63+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#internal-classes-accessed-through-node>`__ on information on how to update your code.
64+
65+
66+
- `#4421 <https://github.com/pytest-dev/pytest/issues/4421>`_: Removed the implementation of the ``pytest_namespace`` hook.
67+
68+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#pytest-namespace>`__ on information on how to update your code.
69+
70+
71+
- `#4489 <https://github.com/pytest-dev/pytest/issues/4489>`_: Removed ``request.cached_setup``. This was the predecessor mechanism to modern fixtures.
72+
73+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#cached-setup>`__ on information on how to update your code.
74+
75+
76+
- `#4535 <https://github.com/pytest-dev/pytest/issues/4535>`_: Removed the deprecated ``PyCollector.makeitem`` method. This method was made public by mistake a long time ago.
77+
78+
79+
- `#4543 <https://github.com/pytest-dev/pytest/issues/4543>`_: Removed support to define fixtures using the ``pytest_funcarg__`` prefix. Use the ``@pytest.fixture`` decorator instead.
80+
81+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#pytest-funcarg-prefix>`__ on information on how to update your code.
82+
83+
84+
- `#4545 <https://github.com/pytest-dev/pytest/issues/4545>`_: Calling fixtures directly is now always an error instead of a warning.
85+
86+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#calling-fixtures-directly>`__ on information on how to update your code.
87+
88+
89+
- `#4546 <https://github.com/pytest-dev/pytest/issues/4546>`_: Remove ``Node.get_marker(name)`` the return value was not usable for more than a existence check.
90+
91+
Use ``Node.get_closest_marker(name)`` as a replacement.
92+
93+
94+
- `#4547 <https://github.com/pytest-dev/pytest/issues/4547>`_: The deprecated ``record_xml_property`` fixture has been removed, use the more generic ``record_property`` instead.
95+
96+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#record-xml-property>`__ for more information.
97+
98+
99+
- `#4548 <https://github.com/pytest-dev/pytest/issues/4548>`_: An error is now raised if the ``pytest_plugins`` variable is defined in a non-top-level ``conftest.py`` file (i.e., not residing in the ``rootdir``).
100+
101+
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#pytest-plugins-in-non-top-level-conftest-files>`__ for more information.
102+
103+
104+
- `#891 <https://github.com/pytest-dev/pytest/issues/891>`_: Remove ``testfunction.markername`` attributes - use ``Node.iter_markers(name=None)`` to iterate them.
105+
106+
107+
108+
Deprecations
109+
------------
110+
111+
- `#3050 <https://github.com/pytest-dev/pytest/issues/3050>`_: Deprecated the ``pytest.config`` global.
112+
113+
See https://docs.pytest.org/en/latest/deprecations.html#pytest-config-global for rationale.
114+
115+
116+
- `#3974 <https://github.com/pytest-dev/pytest/issues/3974>`_: Passing the ``message`` parameter of ``pytest.raises`` now issues a ``DeprecationWarning``.
117+
118+
It is a common mistake to think this parameter will match the exception message, while in fact
119+
it only serves to provide a custom message in case the ``pytest.raises`` check fails. To avoid this
120+
mistake and because it is believed to be little used, pytest is deprecating it without providing
121+
an alternative for the moment.
122+
123+
If you have concerns about this, please comment on `issue #3974 <https://github.com/pytest-dev/pytest/issues/3974>`__.
124+
125+
126+
- `#4435 <https://github.com/pytest-dev/pytest/issues/4435>`_: Deprecated ``raises(..., 'code(as_a_string)')`` and ``warns(..., 'code(as_a_string)')``.
127+
128+
See https://docs.pytest.org/en/latest/deprecations.html#raises-warns-exec for rationale and examples.
129+
130+
131+
132+
Features
133+
--------
134+
135+
- `#3191 <https://github.com/pytest-dev/pytest/issues/3191>`_: A warning is now issued when assertions are made for ``None``.
136+
137+
This is a common source of confusion among new users, which write:
138+
139+
.. code-block:: python
140+
141+
assert mocked_object.assert_called_with(3, 4, 5, key="value")
142+
143+
When they should write:
144+
145+
.. code-block:: python
146+
147+
mocked_object.assert_called_with(3, 4, 5, key="value")
148+
149+
Because the ``assert_called_with`` method of mock objects already executes an assertion.
150+
151+
This warning will not be issued when ``None`` is explicitly checked. An assertion like:
152+
153+
.. code-block:: python
154+
155+
assert variable is None
156+
157+
will not issue the warning.
158+
159+
160+
- `#3632 <https://github.com/pytest-dev/pytest/issues/3632>`_: Richer equality comparison introspection on ``AssertionError`` for objects created using `attrs <http://www.attrs.org/en/stable/>`_ or `dataclasses <https://docs.python.org/3/library/dataclasses.html>`_ (Python 3.7+, `backported to 3.6 <https://pypi.org/project/dataclasses>`_).
161+
162+
163+
- `#4278 <https://github.com/pytest-dev/pytest/issues/4278>`_: ``CACHEDIR.TAG`` files are now created inside cache directories.
164+
165+
Those files are part of the `Cache Directory Tagging Standard <http://www.bford.info/cachedir/spec.html>`__, and can
166+
be used by backup or synchronization programs to identify pytest's cache directory as such.
167+
168+
169+
- `#4292 <https://github.com/pytest-dev/pytest/issues/4292>`_: ``pytest.outcomes.Exit`` is derived from ``SystemExit`` instead of ``KeyboardInterrupt``. This allows us to better handle ``pdb`` exiting.
170+
171+
172+
- `#4371 <https://github.com/pytest-dev/pytest/issues/4371>`_: Updated the ``--collect-only`` option to display test descriptions when ran using ``--verbose``.
173+
174+
175+
- `#4386 <https://github.com/pytest-dev/pytest/issues/4386>`_: Restructured ``ExceptionInfo`` object construction and ensure incomplete instances have a ``repr``/``str``.
176+
177+
178+
- `#4416 <https://github.com/pytest-dev/pytest/issues/4416>`_: pdb: added support for keyword arguments with ``pdb.set_trace``.
179+
180+
It handles ``header`` similar to Python 3.7 does it, and forwards any
181+
other keyword arguments to the ``Pdb`` constructor.
182+
183+
This allows for ``__import__("pdb").set_trace(skip=["foo.*"])``.
184+
185+
186+
- `#4483 <https://github.com/pytest-dev/pytest/issues/4483>`_: Added ini parameter ``junit_duration_report`` to optionally report test call durations, excluding setup and teardown times.
187+
188+
The JUnit XML specification and the default pytest behavior is to include setup and teardown times in the test duration
189+
report. You can include just the call durations instead (excluding setup and teardown) by adding this to your ``pytest.ini`` file:
190+
191+
.. code-block:: ini
192+
193+
[pytest]
194+
junit_duration_report = call
195+
196+
197+
- `#4532 <https://github.com/pytest-dev/pytest/issues/4532>`_: ``-ra`` now will show errors and failures last, instead of as the first items in the summary.
198+
199+
This makes it easier to obtain a list of errors and failures to run tests selectively.
200+
201+
202+
- `#4599 <https://github.com/pytest-dev/pytest/issues/4599>`_: ``pytest.importorskip`` now supports a ``reason`` parameter, which will be shown when the
203+
requested module cannot be imported.
204+
205+
206+
207+
Bug Fixes
208+
---------
209+
210+
- `#3532 <https://github.com/pytest-dev/pytest/issues/3532>`_: ``-p`` now accepts its argument without a space between the value, for example ``-pmyplugin``.
211+
212+
213+
- `#4327 <https://github.com/pytest-dev/pytest/issues/4327>`_: ``approx`` again works with more generic containers, more precisely instances of ``Iterable`` and ``Sized`` instead of more restrictive ``Sequence``.
214+
215+
216+
- `#4397 <https://github.com/pytest-dev/pytest/issues/4397>`_: Ensure that node ids are printable.
217+
218+
219+
- `#4435 <https://github.com/pytest-dev/pytest/issues/4435>`_: Fixed ``raises(..., 'code(string)')`` frame filename.
220+
221+
222+
- `#4458 <https://github.com/pytest-dev/pytest/issues/4458>`_: Display actual test ids in ``--collect-only``.
223+
224+
225+
226+
Improved Documentation
227+
----------------------
228+
229+
- `#4557 <https://github.com/pytest-dev/pytest/issues/4557>`_: Markers example documentation page updated to support latest pytest version.
230+
231+
232+
- `#4558 <https://github.com/pytest-dev/pytest/issues/4558>`_: Update cache documentation example to correctly show cache hit and miss.
233+
234+
235+
- `#4580 <https://github.com/pytest-dev/pytest/issues/4580>`_: Improved detailed summary report documentation.
236+
237+
238+
239+
Trivial/Internal Changes
240+
------------------------
241+
242+
- `#4447 <https://github.com/pytest-dev/pytest/issues/4447>`_: Changed the deprecation type of ``--result-log`` to ``PytestDeprecationWarning``.
243+
244+
It was decided to remove this feature at the next major revision.
245+
246+
21247
pytest 4.0.2 (2018-12-13)
22248
=========================
23249

changelog/2169.removal.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog/3050.deprecation.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

changelog/3078.removal.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

changelog/3079.removal.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

changelog/3082.removal.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

changelog/3083.removal.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

changelog/3085.removal.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

changelog/3086.removal.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

changelog/3191.feature.rst

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)