You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- `#5125 <https://github.com/pytest-dev/pytest/issues/5125>`_: ``Session.exitcode`` values are now coded in ``pytest.ExitCode``, an ``IntEnum``. This makes the exit code available for consumer code and are more explicit other than just documentation. User defined exit codes are still valid, but should be used with caution.
37
+
38
+
The team doesn't expect this change to break test suites or plugins in general, except in esoteric/specific scenarios.
39
+
40
+
**pytest-xdist** users should upgrade to ``1.29.0`` or later, as ``pytest-xdist`` required a compatibility fix because of this change.
41
+
42
+
43
+
- `#5402 <https://github.com/pytest-dev/pytest/issues/5402>`_: **PytestDeprecationWarning are now errors by default.**
44
+
45
+
Following our plan to remove deprecated features with as little disruption as
46
+
possible, all warnings of type ``PytestDeprecationWarning`` now generate errors
47
+
instead of warning messages.
48
+
49
+
**The affected features will be effectively removed in pytest 5.1**, so please consult the
50
+
`Deprecations and Removals <https://docs.pytest.org/en/latest/deprecations.html>`__
51
+
section in the docs for directions on how to update existing code.
52
+
53
+
In the pytest ``5.0.X`` series, it is possible to change the errors back into warnings as a stop
54
+
gap measure by adding this to your ``pytest.ini`` file:
55
+
56
+
.. code-block:: ini
57
+
58
+
[pytest]
59
+
filterwarnings =
60
+
ignore::pytest.PytestDeprecationWarning
61
+
62
+
But this will stop working when pytest ``5.1`` is released.
63
+
64
+
**If you have concerns** about the removal of a specific feature, please add a
65
+
comment to `#5402 <https://github.com/pytest-dev/pytest/issues/5402>`__.
66
+
67
+
68
+
- `#5412 <https://github.com/pytest-dev/pytest/issues/5412>`_: ``ExceptionInfo`` objects (returned by ``pytest.raises``) now have the same ``str`` representation as ``repr``, which
69
+
avoids some confusion when users use ``print(e)`` to inspect the object.
70
+
71
+
72
+
73
+
Deprecations
74
+
------------
75
+
76
+
- `#4488 <https://github.com/pytest-dev/pytest/issues/4488>`_: The removal of the ``--result-log`` option and module has been postponed to (tentatively) pytest 6.0 as
77
+
the team has not yet got around to implement a good alternative for it.
78
+
79
+
80
+
- `#466 <https://github.com/pytest-dev/pytest/issues/466>`_: The ``funcargnames`` attribute has been an alias for ``fixturenames`` since
81
+
pytest 2.3, and is now deprecated in code too.
82
+
83
+
84
+
85
+
Features
86
+
--------
87
+
88
+
- `#3457 <https://github.com/pytest-dev/pytest/issues/3457>`_: New `pytest_assertion_pass <https://docs.pytest.org/en/latest/reference.html#_pytest.hookspec.pytest_assertion_pass>`__
89
+
hook, called with context information when an assertion *passes*.
90
+
91
+
This hook is still **experimental** so use it with caution.
92
+
93
+
94
+
- `#5440 <https://github.com/pytest-dev/pytest/issues/5440>`_: The `faulthandler <https://docs.python.org/3/library/faulthandler.html>`__ standard library
95
+
module is now enabled by default to help users diagnose crashes in C modules.
96
+
97
+
This functionality was provided by integrating the external
98
+
`pytest-faulthandler <https://github.com/pytest-dev/pytest-faulthandler>`__ plugin into the core,
99
+
so users should remove that plugin from their requirements if used.
100
+
101
+
For more information see the docs: https://docs.pytest.org/en/latest/usage.html#fault-handler
102
+
103
+
104
+
- `#5452 <https://github.com/pytest-dev/pytest/issues/5452>`_: When warnings are configured as errors, pytest warnings now appear as originating from ``pytest.`` instead of the internal ``_pytest.warning_types.`` module.
105
+
106
+
107
+
108
+
Bug Fixes
109
+
---------
110
+
111
+
- `#1403 <https://github.com/pytest-dev/pytest/issues/1403>`_: Switch from ``imp`` to ``importlib``.
112
+
113
+
114
+
- `#1671 <https://github.com/pytest-dev/pytest/issues/1671>`_: The name of the ``.pyc`` files cached by the assertion writer now includes the pytest version
115
+
to avoid stale caches.
116
+
117
+
118
+
- `#2761 <https://github.com/pytest-dev/pytest/issues/2761>`_: Honor PEP 235 on case-insensitive file systems.
119
+
120
+
121
+
- `#5078 <https://github.com/pytest-dev/pytest/issues/5078>`_: Test module is no longer double-imported when using ``--pyargs``.
122
+
123
+
124
+
- `#5260 <https://github.com/pytest-dev/pytest/issues/5260>`_: Improved comparison of byte strings.
125
+
126
+
When comparing bytes, the assertion message used to show the byte numeric value when showing the differences::
127
+
128
+
def test():
129
+
> assert b'spam' == b'eggs'
130
+
E AssertionError: assert b'spam' == b'eggs'
131
+
E At index 0 diff: 115 != 101
132
+
E Use -v to get the full diff
133
+
134
+
It now shows the actual ascii representation instead, which is often more useful::
135
+
136
+
def test():
137
+
> assert b'spam' == b'eggs'
138
+
E AssertionError: assert b'spam' == b'eggs'
139
+
E At index 0 diff: b's' != b'e'
140
+
E Use -v to get the full diff
141
+
142
+
143
+
- `#5335 <https://github.com/pytest-dev/pytest/issues/5335>`_: Colorize level names when the level in the logging format is formatted using
144
+
'%(levelname).Xs' (truncated fixed width alignment), where X is an integer.
145
+
146
+
147
+
- `#5354 <https://github.com/pytest-dev/pytest/issues/5354>`_: Fix ``pytest.mark.parametrize`` when the argvalues is an iterator.
148
+
149
+
150
+
- `#5370 <https://github.com/pytest-dev/pytest/issues/5370>`_: Revert unrolling of ``all()`` to fix ``NameError`` on nested comprehensions.
151
+
152
+
153
+
- `#5371 <https://github.com/pytest-dev/pytest/issues/5371>`_: Revert unrolling of ``all()`` to fix incorrect handling of generators with ``if``.
154
+
155
+
156
+
- `#5372 <https://github.com/pytest-dev/pytest/issues/5372>`_: Revert unrolling of ``all()`` to fix incorrect assertion when using ``all()`` in an expression.
157
+
158
+
159
+
- `#5383 <https://github.com/pytest-dev/pytest/issues/5383>`_: ``-q`` has again an impact on the style of the collected items
160
+
(``--collect-only``) when ``--log-cli-level`` is used.
161
+
162
+
163
+
- `#5389 <https://github.com/pytest-dev/pytest/issues/5389>`_: Fix regressions of `#5063 <https://github.com/pytest-dev/pytest/pull/5063>`__ for ``importlib_metadata.PathDistribution`` which have their ``files`` attribute being ``None``.
164
+
165
+
166
+
- `#5390 <https://github.com/pytest-dev/pytest/issues/5390>`_: Fix regression where the ``obj`` attribute of ``TestCase`` items was no longer bound to methods.
167
+
168
+
169
+
- `#5404 <https://github.com/pytest-dev/pytest/issues/5404>`_: Emit a warning when attempting to unwrap a broken object raises an exception,
170
+
for easier debugging (`#5080 <https://github.com/pytest-dev/pytest/issues/5080>`__).
171
+
172
+
173
+
- `#5432 <https://github.com/pytest-dev/pytest/issues/5432>`_: Prevent "already imported" warnings from assertion rewriter when invoking pytest in-process multiple times.
174
+
175
+
176
+
- `#5433 <https://github.com/pytest-dev/pytest/issues/5433>`_: Fix assertion rewriting in packages (``__init__.py``).
177
+
178
+
179
+
- `#5444 <https://github.com/pytest-dev/pytest/issues/5444>`_: Fix ``--stepwise`` mode when the first file passed on the command-line fails to collect.
180
+
181
+
182
+
- `#5482 <https://github.com/pytest-dev/pytest/issues/5482>`_: Fix bug introduced in 4.6.0 causing collection errors when passing
183
+
more than 2 positional arguments to ``pytest.mark.parametrize``.
184
+
185
+
186
+
- `#5505 <https://github.com/pytest-dev/pytest/issues/5505>`_: Fix crash when discovery fails while using ``-p no:terminal``.
187
+
188
+
189
+
190
+
Improved Documentation
191
+
----------------------
192
+
193
+
- `#5315 <https://github.com/pytest-dev/pytest/issues/5315>`_: Expand docs on mocking classes and dictionaries with ``monkeypatch``.
194
+
195
+
196
+
- `#5416 <https://github.com/pytest-dev/pytest/issues/5416>`_: Fix PytestUnknownMarkWarning in run/skip example.
$PYTHON_PREFIX/lib/python3.6/distutils/__init__.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
0 commit comments