Skip to content

Commit 4f9bf02

Browse files
authored
Merge pull request #5522 from nicoddemus/merge-master-into-features
Merge master into features
2 parents 4d5780f + 4bc0415 commit 4f9bf02

File tree

98 files changed

+2265
-995
lines changed

Some content is hidden

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

98 files changed

+2265
-995
lines changed

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
# * https://help.github.com/en/articles/displaying-a-sponsor-button-in-your-repository
33
# * https://tidelift.com/subscription/how-to-connect-tidelift-with-github
44
tidelift: pypi/pytest
5+
open_collective: pytest

.travis.yml

+5-14
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ jobs:
2020
include:
2121
# OSX tests - first (in test stage), since they are the slower ones.
2222
- os: osx
23-
# NOTE: (tests with) pexpect appear to be buggy on Travis,
24-
# at least with coverage.
25-
# Log: https://travis-ci.org/pytest-dev/pytest/jobs/500358864
2623
osx_image: xcode10.1
2724
language: generic
2825
env: TOXENV=py37-xdist PYTEST_COVERAGE=1
@@ -34,7 +31,7 @@ jobs:
3431
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37
3532

3633
# Full run of latest supported version, without xdist.
37-
- env: TOXENV=py37 PYTEST_COVERAGE=1
34+
- env: TOXENV=py37
3835
python: '3.7'
3936

4037
# Coverage tracking is slow with pypy, skip it.
@@ -49,12 +46,12 @@ jobs:
4946
# - TestArgComplete (linux only)
5047
# - numpy
5148
# Empty PYTEST_ADDOPTS to run this non-verbose.
52-
- env: TOXENV=py37-lsof-numpy-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS=
49+
- env: TOXENV=py37-lsof-numpy-twisted-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS=
5350

5451
# Specialized factors for py37.
5552
# Coverage for:
5653
# - test_sys_breakpoint_interception (via pexpect).
57-
- env: TOXENV=py37-pexpect,py37-twisted PYTEST_COVERAGE=1
54+
- env: TOXENV=py37-pexpect PYTEST_COVERAGE=1
5855
- env: TOXENV=py37-pluggymaster-xdist
5956
- env: TOXENV=py37-freeze
6057

@@ -105,18 +102,12 @@ before_script:
105102
export _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
106103
fi
107104
108-
script: tox --recreate
105+
script: tox
109106

110107
after_success:
111108
- |
112109
if [[ "$PYTEST_COVERAGE" = 1 ]]; then
113-
set -e
114-
# Add last TOXENV to $PATH.
115-
PATH="$PWD/.tox/${TOXENV##*,}/bin:$PATH"
116-
coverage combine
117-
coverage xml
118-
coverage report -m
119-
bash <(curl -s https://codecov.io/bash) -Z -X gcov -X coveragepy -X search -X xcode -X gcovout -X fix -f coverage.xml -n $TOXENV-$TRAVIS_OS_NAME
110+
env CODECOV_NAME="$TOXENV-$TRAVIS_OS_NAME" scripts/report-coverage.sh
120111
fi
121112
122113
notifications:

AUTHORS

+2
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ Kale Kundert
135135
Katarzyna Jachim
136136
Katerina Koukiou
137137
Kevin Cox
138+
Kevin J. Foley
138139
Kodi B. Arfer
139140
Kostis Anagnostopoulos
140141
Kristoffer Nordström
@@ -200,6 +201,7 @@ Pulkit Goyal
200201
Punyashloka Biswal
201202
Quentin Pradet
202203
Ralf Schmitt
204+
Ralph Giles
203205
Ran Benita
204206
Raphael Castaneda
205207
Raphael Pierzina

CHANGELOG.rst

+236
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,242 @@ with advance notice in the **Deprecations** section of releases.
1818
1919
.. towncrier release notes start
2020
21+
pytest 5.0.0 (2019-06-28)
22+
=========================
23+
24+
Important
25+
---------
26+
27+
This release is a Python3.5+ only release.
28+
29+
For more details, see our `Python 2.7 and 3.4 support plan <https://docs.pytest.org/en/latest/py27-py34-deprecation.html>`__.
30+
31+
Removals
32+
--------
33+
34+
- `#1149 <https://github.com/pytest-dev/pytest/issues/1149>`_: Pytest no longer accepts prefixes of command-line arguments, for example
35+
typing ``pytest --doctest-mod`` inplace of ``--doctest-modules``.
36+
This was previously allowed where the ``ArgumentParser`` thought it was unambiguous,
37+
but this could be incorrect due to delayed parsing of options for plugins.
38+
See for example issues `#1149 <https://github.com/pytest-dev/pytest/issues/1149>`__,
39+
`#3413 <https://github.com/pytest-dev/pytest/issues/3413>`__, and
40+
`#4009 <https://github.com/pytest-dev/pytest/issues/4009>`__.
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+
- `#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.
108+
109+
The team doesn't expect this change to break test suites or plugins in general, except in esoteric/specific scenarios.
110+
111+
**pytest-xdist** users should upgrade to ``1.29.0`` or later, as ``pytest-xdist`` required a compatibility fix because of this change.
112+
113+
114+
115+
Bug Fixes
116+
---------
117+
118+
- `#1403 <https://github.com/pytest-dev/pytest/issues/1403>`_: Switch from ``imp`` to ``importlib``.
119+
120+
121+
- `#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
122+
to avoid stale caches.
123+
124+
125+
- `#2761 <https://github.com/pytest-dev/pytest/issues/2761>`_: Honor PEP 235 on case-insensitive file systems.
126+
127+
128+
- `#5078 <https://github.com/pytest-dev/pytest/issues/5078>`_: Test module is no longer double-imported when using ``--pyargs``.
129+
130+
131+
- `#5260 <https://github.com/pytest-dev/pytest/issues/5260>`_: Improved comparison of byte strings.
132+
133+
When comparing bytes, the assertion message used to show the byte numeric value when showing the differences::
134+
135+
def test():
136+
> assert b'spam' == b'eggs'
137+
E AssertionError: assert b'spam' == b'eggs'
138+
E At index 0 diff: 115 != 101
139+
E Use -v to get the full diff
140+
141+
It now shows the actual ascii representation instead, which is often more useful::
142+
143+
def test():
144+
> assert b'spam' == b'eggs'
145+
E AssertionError: assert b'spam' == b'eggs'
146+
E At index 0 diff: b's' != b'e'
147+
E Use -v to get the full diff
148+
149+
150+
- `#5335 <https://github.com/pytest-dev/pytest/issues/5335>`_: Colorize level names when the level in the logging format is formatted using
151+
'%(levelname).Xs' (truncated fixed width alignment), where X is an integer.
152+
153+
154+
- `#5354 <https://github.com/pytest-dev/pytest/issues/5354>`_: Fix ``pytest.mark.parametrize`` when the argvalues is an iterator.
155+
156+
157+
- `#5370 <https://github.com/pytest-dev/pytest/issues/5370>`_: Revert unrolling of ``all()`` to fix ``NameError`` on nested comprehensions.
158+
159+
160+
- `#5371 <https://github.com/pytest-dev/pytest/issues/5371>`_: Revert unrolling of ``all()`` to fix incorrect handling of generators with ``if``.
161+
162+
163+
- `#5372 <https://github.com/pytest-dev/pytest/issues/5372>`_: Revert unrolling of ``all()`` to fix incorrect assertion when using ``all()`` in an expression.
164+
165+
166+
- `#5383 <https://github.com/pytest-dev/pytest/issues/5383>`_: ``-q`` has again an impact on the style of the collected items
167+
(``--collect-only``) when ``--log-cli-level`` is used.
168+
169+
170+
- `#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``.
171+
172+
173+
- `#5390 <https://github.com/pytest-dev/pytest/issues/5390>`_: Fix regression where the ``obj`` attribute of ``TestCase`` items was no longer bound to methods.
174+
175+
176+
- `#5404 <https://github.com/pytest-dev/pytest/issues/5404>`_: Emit a warning when attempting to unwrap a broken object raises an exception,
177+
for easier debugging (`#5080 <https://github.com/pytest-dev/pytest/issues/5080>`__).
178+
179+
180+
- `#5432 <https://github.com/pytest-dev/pytest/issues/5432>`_: Prevent "already imported" warnings from assertion rewriter when invoking pytest in-process multiple times.
181+
182+
183+
- `#5433 <https://github.com/pytest-dev/pytest/issues/5433>`_: Fix assertion rewriting in packages (``__init__.py``).
184+
185+
186+
- `#5444 <https://github.com/pytest-dev/pytest/issues/5444>`_: Fix ``--stepwise`` mode when the first file passed on the command-line fails to collect.
187+
188+
189+
- `#5482 <https://github.com/pytest-dev/pytest/issues/5482>`_: Fix bug introduced in 4.6.0 causing collection errors when passing
190+
more than 2 positional arguments to ``pytest.mark.parametrize``.
191+
192+
193+
- `#5505 <https://github.com/pytest-dev/pytest/issues/5505>`_: Fix crash when discovery fails while using ``-p no:terminal``.
194+
195+
196+
197+
Improved Documentation
198+
----------------------
199+
200+
- `#5315 <https://github.com/pytest-dev/pytest/issues/5315>`_: Expand docs on mocking classes and dictionaries with ``monkeypatch``.
201+
202+
203+
- `#5416 <https://github.com/pytest-dev/pytest/issues/5416>`_: Fix PytestUnknownMarkWarning in run/skip example.
204+
205+
206+
pytest 4.6.4 (2019-06-28)
207+
=========================
208+
209+
Bug Fixes
210+
---------
211+
212+
- `#5404 <https://github.com/pytest-dev/pytest/issues/5404>`_: Emit a warning when attempting to unwrap a broken object raises an exception,
213+
for easier debugging (`#5080 <https://github.com/pytest-dev/pytest/issues/5080>`__).
214+
215+
216+
- `#5444 <https://github.com/pytest-dev/pytest/issues/5444>`_: Fix ``--stepwise`` mode when the first file passed on the command-line fails to collect.
217+
218+
219+
- `#5482 <https://github.com/pytest-dev/pytest/issues/5482>`_: Fix bug introduced in 4.6.0 causing collection errors when passing
220+
more than 2 positional arguments to ``pytest.mark.parametrize``.
221+
222+
223+
- `#5505 <https://github.com/pytest-dev/pytest/issues/5505>`_: Fix crash when discovery fails while using ``-p no:terminal``.
224+
225+
226+
pytest 4.6.3 (2019-06-11)
227+
=========================
228+
229+
Bug Fixes
230+
---------
231+
232+
- `#5383 <https://github.com/pytest-dev/pytest/issues/5383>`_: ``-q`` has again an impact on the style of the collected items
233+
(``--collect-only``) when ``--log-cli-level`` is used.
234+
235+
236+
- `#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``.
237+
238+
239+
- `#5390 <https://github.com/pytest-dev/pytest/issues/5390>`_: Fix regression where the ``obj`` attribute of ``TestCase`` items was no longer bound to methods.
240+
241+
242+
pytest 4.6.2 (2019-06-03)
243+
=========================
244+
245+
Bug Fixes
246+
---------
247+
248+
- `#5370 <https://github.com/pytest-dev/pytest/issues/5370>`_: Revert unrolling of ``all()`` to fix ``NameError`` on nested comprehensions.
249+
250+
251+
- `#5371 <https://github.com/pytest-dev/pytest/issues/5371>`_: Revert unrolling of ``all()`` to fix incorrect handling of generators with ``if``.
252+
253+
254+
- `#5372 <https://github.com/pytest-dev/pytest/issues/5372>`_: Revert unrolling of ``all()`` to fix incorrect assertion when using ``all()`` in an expression.
255+
256+
21257
pytest 4.6.1 (2019-06-02)
22258
=========================
23259

CONTRIBUTING.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Short version
173173

174174
The test environments above are usually enough to cover most cases locally.
175175

176-
#. Write a ``changelog`` entry: ``changelog/2574.bugfix``, use issue id number
176+
#. Write a ``changelog`` entry: ``changelog/2574.bugfix.rst``, use issue id number
177177
and one of ``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or
178178
``trivial`` for the issue type.
179179
#. Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please
@@ -264,7 +264,7 @@ Here is a simple overview, with pytest-specific bits:
264264
$ git commit -a -m "<commit message>"
265265
$ git push -u
266266

267-
#. Create a new changelog entry in ``changelog``. The file should be named ``<issueid>.<type>``,
267+
#. Create a new changelog entry in ``changelog``. The file should be named ``<issueid>.<type>.rst``,
268268
where *issueid* is the number of the issue related to the change and *type* is one of
269269
``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or ``trivial``.
270270

azure-pipelines.yml

+15-12
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ trigger:
44

55
variables:
66
PYTEST_ADDOPTS: "--junitxml=build/test-results/$(tox.env).xml -vv"
7-
COVERAGE_FILE: "$(Build.Repository.LocalPath)/.coverage"
8-
COVERAGE_PROCESS_START: "$(Build.Repository.LocalPath)/.coveragerc"
97
PYTEST_COVERAGE: '0'
108

119
jobs:
@@ -30,17 +28,14 @@ jobs:
3028
tox.env: 'py36-xdist'
3129
py37:
3230
python.version: '3.7'
33-
tox.env: 'py37'
31+
tox.env: 'py37-twisted-numpy'
3432
# Coverage for:
3533
# - _py36_windowsconsoleio_workaround (with py36+)
3634
# - test_request_garbage (no xdist)
3735
PYTEST_COVERAGE: '1'
3836
py37-linting/docs/doctesting:
3937
python.version: '3.7'
4038
tox.env: 'linting,docs,doctesting'
41-
py37-twisted/numpy:
42-
python.version: '3.7'
43-
tox.env: 'py37-twisted,py37-numpy'
4439
py37-pluggymaster-xdist:
4540
python.version: '3.7'
4641
tox.env: 'py37-pluggymaster-xdist'
@@ -55,8 +50,13 @@ jobs:
5550
- script: python -m pip install --upgrade pip && python -m pip install tox
5651
displayName: 'Install tox'
5752

58-
- script: |
59-
call scripts/setup-coverage-vars.bat || goto :eof
53+
- bash: |
54+
if [[ "$PYTEST_COVERAGE" == "1" ]]; then
55+
export _PYTEST_TOX_COVERAGE_RUN="coverage run -m"
56+
export _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
57+
export COVERAGE_FILE="$PWD/.coverage"
58+
export COVERAGE_PROCESS_START="$PWD/.coveragerc"
59+
fi
6060
python -m tox -e $(tox.env)
6161
displayName: 'Run tests'
6262
@@ -66,9 +66,12 @@ jobs:
6666
testRunTitle: '$(tox.env)'
6767
condition: succeededOrFailed()
6868

69-
- script: call scripts\upload-coverage.bat
70-
displayName: 'Report and upload coverage'
71-
condition: eq(variables['PYTEST_COVERAGE'], '1')
69+
- bash: |
70+
if [[ "$PYTEST_COVERAGE" == 1 ]]; then
71+
scripts/report-coverage.sh
72+
fi
7273
env:
74+
CODECOV_NAME: $(tox.env)
7375
CODECOV_TOKEN: $(CODECOV_TOKEN)
74-
PYTEST_CODECOV_NAME: $(tox.env)
76+
displayName: Report and upload coverage
77+
condition: eq(variables['PYTEST_COVERAGE'], '1')

0 commit comments

Comments
 (0)