Skip to content

Commit 59f6523

Browse files
Merge pull request #4454 from nicoddemus/merge-master-into-features
Merge master into features
2 parents 63f90a2 + 5bee396 commit 59f6523

Some content is hidden

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

55 files changed

+415
-206
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ Michael Droettboom
159159
Michael Seifert
160160
Michal Wajszczuk
161161
Mihai Capotă
162+
Mike Hoyle (hoylemd)
162163
Mike Lundy
163164
Miro Hrončok
164165
Nathaniel Waisbrot

CHANGELOG.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,43 @@ with advance notice in the **Deprecations** section of releases.
1818
1919
.. towncrier release notes start
2020
21+
pytest 4.0.1 (2018-11-23)
22+
=========================
23+
24+
Bug Fixes
25+
---------
26+
27+
- `#3952 <https://github.com/pytest-dev/pytest/issues/3952>`_: Display warnings before "short test summary info" again, but still later warnings in the end.
28+
29+
30+
- `#4386 <https://github.com/pytest-dev/pytest/issues/4386>`_: Handle uninitialized exceptioninfo in repr/str.
31+
32+
33+
- `#4393 <https://github.com/pytest-dev/pytest/issues/4393>`_: Do not create ``.gitignore``/``README.md`` files in existing cache directories.
34+
35+
36+
- `#4400 <https://github.com/pytest-dev/pytest/issues/4400>`_: Rearrange warning handling for the yield test errors so the opt-out in 4.0.x correctly works.
37+
38+
39+
- `#4405 <https://github.com/pytest-dev/pytest/issues/4405>`_: Fix collection of testpaths with ``--pyargs``.
40+
41+
42+
- `#4412 <https://github.com/pytest-dev/pytest/issues/4412>`_: Fix assertion rewriting involving ``Starred`` + side-effects.
43+
44+
45+
- `#4425 <https://github.com/pytest-dev/pytest/issues/4425>`_: Ensure we resolve the absolute path when the given ``--basetemp`` is a relative path.
46+
47+
48+
49+
Trivial/Internal Changes
50+
------------------------
51+
52+
- `#4315 <https://github.com/pytest-dev/pytest/issues/4315>`_: Use ``pkg_resources.parse_version`` instead of ``LooseVersion`` in minversion check.
53+
54+
55+
- `#4440 <https://github.com/pytest-dev/pytest/issues/4440>`_: Adjust the stack level of some internal pytest warnings.
56+
57+
2158
pytest 4.0.0 (2018-11-13)
2259
=========================
2360

changelog/4400.bugfix.rst

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

changelog/4405.bugfix.rst

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

changelog/4412.bugfix.rst

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

changelog/4435.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ``raises(..., 'code(string)')`` frame filename.

doc/en/announce/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Release announcements
66
:maxdepth: 2
77

88

9+
release-4.0.1
910
release-4.0.0
1011
release-3.10.1
1112
release-3.10.0

doc/en/announce/release-4.0.1.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
pytest-4.0.1
2+
=======================================
3+
4+
pytest 4.0.1 has just been released to PyPI.
5+
6+
This is a bug-fix release, being a drop-in replacement. To upgrade::
7+
8+
pip install --upgrade pytest
9+
10+
The full changelog is available at https://docs.pytest.org/en/latest/changelog.html.
11+
12+
Thanks to all who contributed to this release, among them:
13+
14+
* Anthony Sottile
15+
* Bruno Oliveira
16+
* Daniel Hahler
17+
* Michael D. Hoyle
18+
* Ronny Pfannschmidt
19+
* Slam
20+
21+
22+
Happy testing,
23+
The pytest Development Team

doc/en/assert.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ you will see the return value of the function call::
2626

2727
$ pytest test_assert1.py
2828
=========================== test session starts ============================
29-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
29+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
3030
rootdir: $REGENDOC_TMPDIR, inifile:
3131
collected 1 item
3232

@@ -169,7 +169,7 @@ if you run this module::
169169

170170
$ pytest test_assert2.py
171171
=========================== test session starts ============================
172-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
172+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
173173
rootdir: $REGENDOC_TMPDIR, inifile:
174174
collected 1 item
175175

doc/en/cache.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ If you then run it with ``--lf``::
7676

7777
$ pytest --lf
7878
=========================== test session starts ============================
79-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
79+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
8080
rootdir: $REGENDOC_TMPDIR, inifile:
8181
collected 50 items / 48 deselected
8282
run-last-failure: rerun previous 2 failures
@@ -117,7 +117,7 @@ of ``FF`` and dots)::
117117

118118
$ pytest --ff
119119
=========================== test session starts ============================
120-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
120+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
121121
rootdir: $REGENDOC_TMPDIR, inifile:
122122
collected 50 items
123123
run-last-failure: rerun previous 2 failures first
@@ -236,7 +236,7 @@ You can always peek at the content of the cache using the
236236

237237
$ pytest --cache-show
238238
=========================== test session starts ============================
239-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
239+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
240240
rootdir: $REGENDOC_TMPDIR, inifile:
241241
cachedir: $REGENDOC_TMPDIR/.pytest_cache
242242
------------------------------- cache values -------------------------------

doc/en/capture.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ is that you can use print statements for debugging::
5252
# content of test_module.py
5353

5454
def setup_function(function):
55-
print ("setting up %s" % function)
55+
print("setting up %s" % function)
5656

5757
def test_func1():
5858
assert True
@@ -65,7 +65,7 @@ of the failing function and hide the other one::
6565

6666
$ pytest
6767
=========================== test session starts ============================
68-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
68+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
6969
rootdir: $REGENDOC_TMPDIR, inifile:
7070
collected 2 items
7171

doc/en/doctest.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ then you can just invoke ``pytest`` without command line options::
6262

6363
$ pytest
6464
=========================== test session starts ============================
65-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
65+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
6666
rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
6767
collected 1 item
6868

doc/en/example/markers.rst

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ You can then restrict a test run to only run tests marked with ``webtest``::
3131

3232
$ pytest -v -m webtest
3333
=========================== test session starts ============================
34-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
34+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
3535
cachedir: .pytest_cache
3636
rootdir: $REGENDOC_TMPDIR, inifile:
3737
collecting ... collected 4 items / 3 deselected
@@ -44,7 +44,7 @@ Or the inverse, running all tests except the webtest ones::
4444

4545
$ pytest -v -m "not webtest"
4646
=========================== test session starts ============================
47-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
47+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
4848
cachedir: .pytest_cache
4949
rootdir: $REGENDOC_TMPDIR, inifile:
5050
collecting ... collected 4 items / 1 deselected
@@ -64,7 +64,7 @@ tests based on their module, class, method, or function name::
6464

6565
$ pytest -v test_server.py::TestClass::test_method
6666
=========================== test session starts ============================
67-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
67+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
6868
cachedir: .pytest_cache
6969
rootdir: $REGENDOC_TMPDIR, inifile:
7070
collecting ... collected 1 item
@@ -77,7 +77,7 @@ You can also select on the class::
7777

7878
$ pytest -v test_server.py::TestClass
7979
=========================== test session starts ============================
80-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
80+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
8181
cachedir: .pytest_cache
8282
rootdir: $REGENDOC_TMPDIR, inifile:
8383
collecting ... collected 1 item
@@ -90,7 +90,7 @@ Or select multiple nodes::
9090

9191
$ pytest -v test_server.py::TestClass test_server.py::test_send_http
9292
=========================== test session starts ============================
93-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
93+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
9494
cachedir: .pytest_cache
9595
rootdir: $REGENDOC_TMPDIR, inifile:
9696
collecting ... collected 2 items
@@ -128,7 +128,7 @@ select tests based on their names::
128128

129129
$ pytest -v -k http # running with the above defined example module
130130
=========================== test session starts ============================
131-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
131+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
132132
cachedir: .pytest_cache
133133
rootdir: $REGENDOC_TMPDIR, inifile:
134134
collecting ... collected 4 items / 3 deselected
@@ -141,7 +141,7 @@ And you can also run all tests except the ones that match the keyword::
141141

142142
$ pytest -k "not send_http" -v
143143
=========================== test session starts ============================
144-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
144+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
145145
cachedir: .pytest_cache
146146
rootdir: $REGENDOC_TMPDIR, inifile:
147147
collecting ... collected 4 items / 1 deselected
@@ -156,7 +156,7 @@ Or to select "http" and "quick" tests::
156156

157157
$ pytest -k "http or quick" -v
158158
=========================== test session starts ============================
159-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
159+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
160160
cachedir: .pytest_cache
161161
rootdir: $REGENDOC_TMPDIR, inifile:
162162
collecting ... collected 4 items / 2 deselected
@@ -271,8 +271,12 @@ You can also set a module level marker::
271271
import pytest
272272
pytestmark = pytest.mark.webtest
273273

274-
in which case it will be applied to all functions and
275-
methods defined in the module.
274+
or multiple markers::
275+
276+
pytestmark = [pytest.mark.webtest, pytest.mark.slowtest]
277+
278+
in which case markers will be applied (in left-to-right order) to
279+
all functions and methods defined in the module.
276280

277281
.. _`marking individual tests when using parametrize`:
278282

@@ -351,7 +355,7 @@ the test needs::
351355

352356
$ pytest -E stage2
353357
=========================== test session starts ============================
354-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
358+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
355359
rootdir: $REGENDOC_TMPDIR, inifile:
356360
collected 1 item
357361

@@ -363,7 +367,7 @@ and here is one that specifies exactly the environment needed::
363367

364368
$ pytest -E stage1
365369
=========================== test session starts ============================
366-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
370+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
367371
rootdir: $REGENDOC_TMPDIR, inifile:
368372
collected 1 item
369373

@@ -462,7 +466,7 @@ test function. From a conftest file we can read it like this::
462466

463467
def pytest_runtest_setup(item):
464468
for mark in item.iter_markers(name='glob'):
465-
print ("glob args=%s kwargs=%s" %(mark.args, mark.kwargs))
469+
print("glob args=%s kwargs=%s" % (mark.args, mark.kwargs))
466470
sys.stdout.flush()
467471

468472
Let's run this without capturing output and see what we get::
@@ -524,7 +528,7 @@ then you will see two tests skipped and two executed tests as expected::
524528

525529
$ pytest -rs # this option reports skip reasons
526530
=========================== test session starts ============================
527-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
531+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
528532
rootdir: $REGENDOC_TMPDIR, inifile:
529533
collected 4 items
530534

@@ -538,7 +542,7 @@ Note that if you specify a platform via the marker-command line option like this
538542

539543
$ pytest -m linux
540544
=========================== test session starts ============================
541-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
545+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
542546
rootdir: $REGENDOC_TMPDIR, inifile:
543547
collected 4 items / 3 deselected
544548

@@ -589,7 +593,7 @@ We can now use the ``-m option`` to select one set::
589593

590594
$ pytest -m interface --tb=short
591595
=========================== test session starts ============================
592-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
596+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
593597
rootdir: $REGENDOC_TMPDIR, inifile:
594598
collected 4 items / 2 deselected
595599

@@ -610,7 +614,7 @@ or to select both "event" and "interface" tests::
610614

611615
$ pytest -m "interface or event" --tb=short
612616
=========================== test session starts ============================
613-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
617+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
614618
rootdir: $REGENDOC_TMPDIR, inifile:
615619
collected 4 items / 1 deselected
616620

doc/en/example/nonpython.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ now execute the test specification::
2727

2828
nonpython $ pytest test_simple.yml
2929
=========================== test session starts ============================
30-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
30+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
3131
rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
3232
collected 2 items
3333

@@ -59,7 +59,7 @@ consulted when reporting in ``verbose`` mode::
5959

6060
nonpython $ pytest -v
6161
=========================== test session starts ============================
62-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
62+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6
6363
cachedir: .pytest_cache
6464
rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
6565
collecting ... collected 2 items
@@ -81,7 +81,7 @@ interesting to just look at the collection tree::
8181

8282
nonpython $ pytest --collect-only
8383
=========================== test session starts ============================
84-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
84+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
8585
rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
8686
collected 2 items
8787
<Package '$REGENDOC_TMPDIR/nonpython'>

doc/en/example/parametrize.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ objects, they are still using the default pytest representation::
139139

140140
$ pytest test_time.py --collect-only
141141
=========================== test session starts ============================
142-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
142+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
143143
rootdir: $REGENDOC_TMPDIR, inifile:
144144
collected 8 items
145145
<Module 'test_time.py'>
@@ -195,7 +195,7 @@ this is a fully self-contained example which you can run with::
195195

196196
$ pytest test_scenarios.py
197197
=========================== test session starts ============================
198-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
198+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
199199
rootdir: $REGENDOC_TMPDIR, inifile:
200200
collected 4 items
201201

@@ -208,7 +208,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia
208208

209209
$ pytest --collect-only test_scenarios.py
210210
=========================== test session starts ============================
211-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
211+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
212212
rootdir: $REGENDOC_TMPDIR, inifile:
213213
collected 4 items
214214
<Module 'test_scenarios.py'>
@@ -272,7 +272,7 @@ Let's first see how it looks like at collection time::
272272

273273
$ pytest test_backends.py --collect-only
274274
=========================== test session starts ============================
275-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
275+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
276276
rootdir: $REGENDOC_TMPDIR, inifile:
277277
collected 2 items
278278
<Module 'test_backends.py'>
@@ -333,7 +333,7 @@ The result of this test will be successful::
333333

334334
$ pytest test_indirect_list.py --collect-only
335335
=========================== test session starts ============================
336-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
336+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
337337
rootdir: $REGENDOC_TMPDIR, inifile:
338338
collected 1 item
339339
<Module 'test_indirect_list.py'>
@@ -460,7 +460,7 @@ If you run this with reporting for skips enabled::
460460

461461
$ pytest -rs test_module.py
462462
=========================== test session starts ============================
463-
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
463+
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
464464
rootdir: $REGENDOC_TMPDIR, inifile:
465465
collected 2 items
466466

0 commit comments

Comments
 (0)