Skip to content

Commit f947cb2

Browse files
committed
Merge remote-tracking branch 'upstream/features' into davidszotten/stepwise
2 parents e478f66 + b432f12 commit f947cb2

Some content is hidden

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

65 files changed

+609
-301
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Thanks for submitting a PR, your contribution is really appreciated!
33
Here's a quick checklist that should be present in PRs (you can delete this text from the final description, this is
44
just a guideline):
55

6-
- [ ] Create a new changelog file in the `changelog` folder, with a name like `<ISSUE NUMBER>.<TYPE>.rst`. See [changelog/README.rst](/changelog/README.rst) for details.
6+
- [ ] Create a new changelog file in the `changelog` folder, with a name like `<ISSUE NUMBER>.<TYPE>.rst`. See [changelog/README.rst](https://github.com/pytest-dev/pytest/blob/master/changelog/README.rst) for details.
77
- [ ] Target the `master` branch for bug fixes, documentation updates and trivial changes.
88
- [ ] Target the `features` branch for new features and removals/deprecations.
99
- [ ] Include documentation when adding new features.

.travis.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@ install:
1212
- pip install --upgrade --pre tox
1313
env:
1414
matrix:
15-
# note: please use "tox --listenvs" to populate the build matrix below
16-
# please remove the linting env in all cases
17-
- TOXENV=py27-pexpect
15+
# Specialized factors for py27.
16+
- TOXENV=py27-pexpect,py27-trial,py27-numpy
17+
- TOXENV=py27-nobyte
1818
- TOXENV=py27-xdist
19-
- TOXENV=py27-trial
20-
- TOXENV=py27-numpy
2119
- TOXENV=py27-pluggymaster PYTEST_NO_COVERAGE=1
22-
- TOXENV=py36-pexpect
20+
# Specialized factors for py36.
21+
- TOXENV=py36-pexpect,py36-trial,py36-numpy
2322
- TOXENV=py36-xdist
24-
- TOXENV=py36-trial
25-
- TOXENV=py36-numpy
2623
- TOXENV=py36-pluggymaster PYTEST_NO_COVERAGE=1
27-
- TOXENV=py27-nobyte
2824

2925
jobs:
3026
include:
@@ -97,12 +93,6 @@ after_success:
9793
coverage xml --ignore-errors
9894
coverage report -m --ignore-errors
9995
bash <(curl -s https://codecov.io/bash) -Z -X gcov -X coveragepy -X search -X xcode -X gcovout -X fix -f coverage.xml -F "${TOXENV//-/,},linux"
100-
101-
# Coveralls does not support merged reports.
102-
if [[ "$TOXENV" = py37 ]]; then
103-
pip install coveralls
104-
coveralls
105-
fi
10696
fi
10797
10898
notifications:

AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ Stefan Zimmermann
204204
Stefano Taschini
205205
Steffen Allner
206206
Stephan Obermann
207+
Sven-Hendrik Haase
207208
Tadek Teleżyński
208209
Tarcisio Fischer
209210
Tareq Alayan
@@ -213,6 +214,7 @@ Thomas Hisch
213214
Tim Strazny
214215
Tom Dalton
215216
Tom Viner
217+
Tomer Keren
216218
Trevor Bekolay
217219
Tyler Goodlet
218220
Tzu-ping Chung

CHANGELOG.rst

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,163 @@ with advance notice in the **Deprecations** section of releases.
1818
1919
.. towncrier release notes start
2020
21+
pytest 3.9.1 (2018-10-16)
22+
=========================
23+
24+
Features
25+
--------
26+
27+
- `#4159 <https://github.com/pytest-dev/pytest/issues/4159>`_: For test-suites containing test classes, the information about the subclassed
28+
module is now output only if a higher verbosity level is specified (at least
29+
"-vv").
30+
31+
32+
pytest 3.9.0 (2018-10-15 - not published due to a release automation bug)
33+
=========================================================================
34+
35+
Deprecations
36+
------------
37+
38+
- `#3616 <https://github.com/pytest-dev/pytest/issues/3616>`_: The following accesses have been documented as deprecated for years, but are now actually emitting deprecation warnings.
39+
40+
* Access of ``Module``, ``Function``, ``Class``, ``Instance``, ``File`` and ``Item`` through ``Node`` instances. Now
41+
users will this warning::
42+
43+
usage of Function.Module is deprecated, please use pytest.Module instead
44+
45+
Users should just ``import pytest`` and access those objects using the ``pytest`` module.
46+
47+
* ``request.cached_setup``, this was the precursor of the setup/teardown mechanism available to fixtures. You can
48+
consult `funcarg comparison section in the docs <https://docs.pytest.org/en/latest/funcarg_compare.html>`_.
49+
50+
* Using objects named ``"Class"`` as a way to customize the type of nodes that are collected in ``Collector``
51+
subclasses has been deprecated. Users instead should use ``pytest_collect_make_item`` to customize node types during
52+
collection.
53+
54+
This issue should affect only advanced plugins who create new collection types, so if you see this warning
55+
message please contact the authors so they can change the code.
56+
57+
* The warning that produces the message below has changed to ``RemovedInPytest4Warning``::
58+
59+
getfuncargvalue is deprecated, use getfixturevalue
60+
61+
62+
- `#3988 <https://github.com/pytest-dev/pytest/issues/3988>`_: Add a Deprecation warning for pytest.ensuretemp as it was deprecated since a while.
63+
64+
65+
66+
Features
67+
--------
68+
69+
- `#2293 <https://github.com/pytest-dev/pytest/issues/2293>`_: Improve usage errors messages by hiding internal details which can be distracting and noisy.
70+
71+
This has the side effect that some error conditions that previously raised generic errors (such as
72+
``ValueError`` for unregistered marks) are now raising ``Failed`` exceptions.
73+
74+
75+
- `#3332 <https://github.com/pytest-dev/pytest/issues/3332>`_: Improve the error displayed when a ``conftest.py`` file could not be imported.
76+
77+
In order to implement this, a new ``chain`` parameter was added to ``ExceptionInfo.getrepr``
78+
to show or hide chained tracebacks in Python 3 (defaults to ``True``).
79+
80+
81+
- `#3849 <https://github.com/pytest-dev/pytest/issues/3849>`_: Add ``empty_parameter_set_mark=fail_at_collect`` ini option for raising an exception when parametrize collects an empty set.
82+
83+
84+
- `#3964 <https://github.com/pytest-dev/pytest/issues/3964>`_: Log messages generated in the collection phase are shown when
85+
live-logging is enabled and/or when they are logged to a file.
86+
87+
88+
- `#3985 <https://github.com/pytest-dev/pytest/issues/3985>`_: Introduce ``tmp_path`` as a fixture providing a Path object.
89+
90+
91+
- `#4013 <https://github.com/pytest-dev/pytest/issues/4013>`_: Deprecation warnings are now shown even if you customize the warnings filters yourself. In the previous version
92+
any customization would override pytest's filters and deprecation warnings would fall back to being hidden by default.
93+
94+
95+
- `#4073 <https://github.com/pytest-dev/pytest/issues/4073>`_: Allow specification of timeout for ``Testdir.runpytest_subprocess()`` and ``Testdir.run()``.
96+
97+
98+
- `#4098 <https://github.com/pytest-dev/pytest/issues/4098>`_: Add returncode argument to pytest.exit() to exit pytest with a specific return code.
99+
100+
101+
- `#4102 <https://github.com/pytest-dev/pytest/issues/4102>`_: Reimplement ``pytest.deprecated_call`` using ``pytest.warns`` so it supports the ``match='...'`` keyword argument.
102+
103+
This has the side effect that ``pytest.deprecated_call`` now raises ``pytest.fail.Exception`` instead
104+
of ``AssertionError``.
105+
106+
107+
- `#4149 <https://github.com/pytest-dev/pytest/issues/4149>`_: Require setuptools>=30.3 and move most of the metadata to ``setup.cfg``.
108+
109+
110+
111+
Bug Fixes
112+
---------
113+
114+
- `#2535 <https://github.com/pytest-dev/pytest/issues/2535>`_: Improve error message when test functions of ``unittest.TestCase`` subclasses use a parametrized fixture.
115+
116+
117+
- `#3057 <https://github.com/pytest-dev/pytest/issues/3057>`_: ``request.fixturenames`` now correctly returns the name of fixtures created by ``request.getfixturevalue()``.
118+
119+
120+
- `#3946 <https://github.com/pytest-dev/pytest/issues/3946>`_: Warning filters passed as command line options using ``-W`` now take precedence over filters defined in ``ini``
121+
configuration files.
122+
123+
124+
- `#4066 <https://github.com/pytest-dev/pytest/issues/4066>`_: Fix source reindenting by using ``textwrap.dedent`` directly.
125+
126+
127+
- `#4102 <https://github.com/pytest-dev/pytest/issues/4102>`_: ``pytest.warn`` will capture previously-warned warnings in Python 2. Previously they were never raised.
128+
129+
130+
- `#4108 <https://github.com/pytest-dev/pytest/issues/4108>`_: Resolve symbolic links for args.
131+
132+
This fixes running ``pytest tests/test_foo.py::test_bar``, where ``tests``
133+
is a symlink to ``project/app/tests``:
134+
previously ``project/app/conftest.py`` would be ignored for fixtures then.
135+
136+
137+
- `#4132 <https://github.com/pytest-dev/pytest/issues/4132>`_: Fix duplicate printing of internal errors when using ``--pdb``.
138+
139+
140+
- `#4135 <https://github.com/pytest-dev/pytest/issues/4135>`_: pathlib based tmpdir cleanup now correctly handles symlinks in the folder.
141+
142+
143+
- `#4152 <https://github.com/pytest-dev/pytest/issues/4152>`_: Display the filename when encountering ``SyntaxWarning``.
144+
145+
146+
147+
Improved Documentation
148+
----------------------
149+
150+
- `#3713 <https://github.com/pytest-dev/pytest/issues/3713>`_: Update usefixtures documentation to clarify that it can't be used with fixture functions.
151+
152+
153+
- `#4058 <https://github.com/pytest-dev/pytest/issues/4058>`_: Update fixture documentation to specify that a fixture can be invoked twice in the scope it's defined for.
154+
155+
156+
- `#4064 <https://github.com/pytest-dev/pytest/issues/4064>`_: According to unittest.rst, setUpModule and tearDownModule were not implemented, but it turns out they are. So updated the documentation for unittest.
157+
158+
159+
- `#4151 <https://github.com/pytest-dev/pytest/issues/4151>`_: Add tempir testing example to CONTRIBUTING.rst guide
160+
161+
162+
163+
Trivial/Internal Changes
164+
------------------------
165+
166+
- `#2293 <https://github.com/pytest-dev/pytest/issues/2293>`_: The internal ``MarkerError`` exception has been removed.
167+
168+
169+
- `#3988 <https://github.com/pytest-dev/pytest/issues/3988>`_: Port the implementation of tmpdir to pathlib.
170+
171+
172+
- `#4063 <https://github.com/pytest-dev/pytest/issues/4063>`_: Exclude 0.00 second entries from ``--duration`` output unless ``-vv`` is passed on the command-line.
173+
174+
175+
- `#4093 <https://github.com/pytest-dev/pytest/issues/4093>`_: Fixed formatting of string literals in internal tests.
176+
177+
21178
pytest 3.8.2 (2018-10-02)
22179
=========================
23180

CONTRIBUTING.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,47 @@ Here is a simple overview, with pytest-specific bits:
280280
base: features # if it's a feature
281281

282282

283+
Writing Tests
284+
----------------------------
285+
286+
Writing tests for plugins or for pytest itself is often done using the `testdir fixture <https://docs.pytest.org/en/latest/reference.html#testdir>`_, as a "black-box" test.
287+
288+
For example, to ensure a simple test passes you can write:
289+
290+
.. code-block:: python
291+
292+
def test_true_assertion(testdir):
293+
testdir.makepyfile(
294+
"""
295+
def test_foo():
296+
assert True
297+
"""
298+
)
299+
result = testdir.runpytest()
300+
result.assert_outcomes(failed=0, passed=1)
301+
302+
303+
Alternatively, it is possible to make checks based on the actual output of the termal using
304+
*glob-like* expressions:
305+
306+
.. code-block:: python
307+
308+
def test_true_assertion(testdir):
309+
testdir.makepyfile(
310+
"""
311+
def test_foo():
312+
assert False
313+
"""
314+
)
315+
result = testdir.runpytest()
316+
result.stdout.fnmatch_lines(["*assert False*", "*1 failed*"])
317+
318+
When choosing a file where to write a new test, take a look at the existing files and see if there's
319+
one file which looks like a good fit. For example, a regression test about a bug in the ``--lf`` option
320+
should go into ``test_cacheprovider.py``, given that this option is implemented in ``cacheprovider.py``.
321+
If in doubt, go ahead and open a PR with your best guess and we can discuss this over the code.
322+
323+
283324
Joining the Development Team
284325
----------------------------
285326

appveyor.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
environment:
22
matrix:
3-
- TOXENV: "linting,docs,doctesting"
4-
PYTEST_NO_COVERAGE: "1"
53
- TOXENV: "py27"
6-
- TOXENV: "py34"
7-
- TOXENV: "py35"
8-
- TOXENV: "py36"
94
- TOXENV: "py37"
5+
PYTEST_NO_COVERAGE: "1"
6+
- TOXENV: "linting,docs,doctesting"
7+
- TOXENV: "py36"
8+
- TOXENV: "py35"
9+
- TOXENV: "py34"
1010
- TOXENV: "pypy"
1111
PYTEST_NO_COVERAGE: "1"
12-
- TOXENV: "py27-xdist"
13-
- TOXENV: "py27-trial"
14-
- TOXENV: "py27-numpy"
12+
# Specialized factors for py27.
13+
- TOXENV: "py27-trial,py27-numpy,py27-nobyte"
1514
- TOXENV: "py27-pluggymaster"
1615
PYTEST_NO_COVERAGE: "1"
17-
- TOXENV: "py36-xdist"
18-
- TOXENV: "py36-trial"
19-
- TOXENV: "py36-numpy"
16+
- TOXENV: "py27-xdist"
17+
# Specialized factors for py36.
18+
- TOXENV: "py36-trial,py36-numpy"
2019
- TOXENV: "py36-pluggymaster"
2120
PYTEST_NO_COVERAGE: "1"
22-
- TOXENV: "py27-nobyte"
2321
- TOXENV: "py36-freeze"
2422
PYTEST_NO_COVERAGE: "1"
23+
- TOXENV: "py36-xdist"
24+
25+
matrix:
26+
fast_finish: true
2527

2628
install:
2729
- echo Installed Pythons

changelog/2293.feature.rst

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

changelog/2293.trivial.rst

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

changelog/2535.bugfix.rst

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

changelog/3057.bugfix.rst

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

0 commit comments

Comments
 (0)