Skip to content

Commit 5ecff65

Browse files
authored
Merge pull request #3327 from nicoddemus/release-3.5.0
Release 3.5.0
2 parents d7d4afe + beacecf commit 5ecff65

19 files changed

+330
-34
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Janne Vanhala
9292
Jason R. Coombs
9393
Javier Domingo Cansino
9494
Javier Romero
95+
Jeff Rackauckas
9596
Jeff Widman
9697
John Eddie Ayson
9798
John Towler

CHANGELOG.rst

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,158 @@
88
99
.. towncrier release notes start
1010
11+
Pytest 3.5.0 (2018-03-21)
12+
=========================
13+
14+
Deprecations and Removals
15+
-------------------------
16+
17+
- ``record_xml_property`` fixture is now deprecated in favor of the more
18+
generic ``record_property``. (`#2770
19+
<https://github.com/pytest-dev/pytest/issues/2770>`_)
20+
21+
- Defining ``pytest_plugins`` is now deprecated in non-top-level conftest.py
22+
files, because they "leak" to the entire directory tree. (`#3084
23+
<https://github.com/pytest-dev/pytest/issues/3084>`_)
24+
25+
26+
Features
27+
--------
28+
29+
- New ``--show-capture`` command-line option that allows to specify how to
30+
display captured output when tests fail: ``no``, ``stdout``, ``stderr``,
31+
``log`` or ``all`` (the default). (`#1478
32+
<https://github.com/pytest-dev/pytest/issues/1478>`_)
33+
34+
- New ``--rootdir`` command-line option to override the rules for discovering
35+
the root directory. See `customize
36+
<https://docs.pytest.org/en/latest/customize.html>`_ in the documentation for
37+
details. (`#1642 <https://github.com/pytest-dev/pytest/issues/1642>`_)
38+
39+
- Fixtures are now instantiated based on their scopes, with higher-scoped
40+
fixtures (such as ``session``) being instantiated first than lower-scoped
41+
fixtures (such as ``function``). The relative order of fixtures of the same
42+
scope is kept unchanged, based in their declaration order and their
43+
dependencies. (`#2405 <https://github.com/pytest-dev/pytest/issues/2405>`_)
44+
45+
- ``record_xml_property`` renamed to ``record_property`` and is now compatible
46+
with xdist, markers and any reporter. ``record_xml_property`` name is now
47+
deprecated. (`#2770 <https://github.com/pytest-dev/pytest/issues/2770>`_)
48+
49+
- New ``--nf``, ``--new-first`` options: run new tests first followed by the
50+
rest of the tests, in both cases tests are also sorted by the file modified
51+
time, with more recent files coming first. (`#3034
52+
<https://github.com/pytest-dev/pytest/issues/3034>`_)
53+
54+
- New ``--last-failed-no-failures`` command-line option that allows to specify
55+
the behavior of the cache plugin's ```--last-failed`` feature when no tests
56+
failed in the last run (or no cache was found): ``none`` or ``all`` (the
57+
default). (`#3139 <https://github.com/pytest-dev/pytest/issues/3139>`_)
58+
59+
- New ``--doctest-continue-on-failure`` command-line option to enable doctests
60+
to show multiple failures for each snippet, instead of stopping at the first
61+
failure. (`#3149 <https://github.com/pytest-dev/pytest/issues/3149>`_)
62+
63+
- Captured log messages are added to the ``<system-out>`` tag in the generated
64+
junit xml file if the ``junit_logging`` ini option is set to ``system-out``.
65+
If the value of this ini option is ``system-err`, the logs are written to
66+
``<system-err>``. The default value for ``junit_logging`` is ``no``, meaning
67+
captured logs are not written to the output file. (`#3156
68+
<https://github.com/pytest-dev/pytest/issues/3156>`_)
69+
70+
- Allow the logging plugin to handle ``pytest_runtest_logstart`` and
71+
``pytest_runtest_logfinish`` hooks when live logs are enabled. (`#3189
72+
<https://github.com/pytest-dev/pytest/issues/3189>`_)
73+
74+
- Passing `--log-cli-level` in the command-line now automatically activates
75+
live logging. (`#3190 <https://github.com/pytest-dev/pytest/issues/3190>`_)
76+
77+
- Add command line option ``--deselect`` to allow deselection of individual
78+
tests at collection time. (`#3198
79+
<https://github.com/pytest-dev/pytest/issues/3198>`_)
80+
81+
- Captured logs are printed before entering pdb. (`#3204
82+
<https://github.com/pytest-dev/pytest/issues/3204>`_)
83+
84+
- Deselected item count is now shown before tests are run, e.g. ``collected X
85+
items / Y deselected``. (`#3213
86+
<https://github.com/pytest-dev/pytest/issues/3213>`_)
87+
88+
- The builtin module ``platform`` is now available for use in expressions in
89+
``pytest.mark``. (`#3236
90+
<https://github.com/pytest-dev/pytest/issues/3236>`_)
91+
92+
- The *short test summary info* section now is displayed after tracebacks and
93+
warnings in the terminal. (`#3255
94+
<https://github.com/pytest-dev/pytest/issues/3255>`_)
95+
96+
- New ``--verbosity`` flag to set verbosity level explicitly. (`#3296
97+
<https://github.com/pytest-dev/pytest/issues/3296>`_)
98+
99+
- ``pytest.approx`` now accepts comparing a numpy array with a scalar. (`#3312
100+
<https://github.com/pytest-dev/pytest/issues/3312>`_)
101+
102+
103+
Bug Fixes
104+
---------
105+
106+
- Suppress ``IOError`` when closing the temporary file used for capturing
107+
streams in Python 2.7. (`#2370
108+
<https://github.com/pytest-dev/pytest/issues/2370>`_)
109+
110+
- Fixed ``clear()`` method on ``caplog`` fixture which cleared ``records``, but
111+
not the ``text`` property. (`#3297
112+
<https://github.com/pytest-dev/pytest/issues/3297>`_)
113+
114+
- During test collection, when stdin is not allowed to be read, the
115+
``DontReadFromStdin`` object still allow itself to be iterable and resolved
116+
to an iterator without crashing. (`#3314
117+
<https://github.com/pytest-dev/pytest/issues/3314>`_)
118+
119+
120+
Improved Documentation
121+
----------------------
122+
123+
- Added a `reference <https://docs.pytest.org/en/latest/reference.html>`_ page
124+
to the docs. (`#1713 <https://github.com/pytest-dev/pytest/issues/1713>`_)
125+
126+
127+
Trivial/Internal Changes
128+
------------------------
129+
130+
- Change minimum requirement of ``attrs`` to ``17.4.0``. (`#3228
131+
<https://github.com/pytest-dev/pytest/issues/3228>`_)
132+
133+
- Renamed example directories so all tests pass when ran from the base
134+
directory. (`#3245 <https://github.com/pytest-dev/pytest/issues/3245>`_)
135+
136+
- Internal ``mark.py`` module has been turned into a package. (`#3250
137+
<https://github.com/pytest-dev/pytest/issues/3250>`_)
138+
139+
- ``pytest`` now depends on the `more_itertools
140+
<https://github.com/erikrose/more-itertools>`_ package. (`#3265
141+
<https://github.com/pytest-dev/pytest/issues/3265>`_)
142+
143+
- Added warning when ``[pytest]`` section is used in a ``.cfg`` file passed
144+
with ``-c`` (`#3268 <https://github.com/pytest-dev/pytest/issues/3268>`_)
145+
146+
- ``nodeids`` can now be passed explicitly to ``FSCollector`` and ``Node``
147+
constructors. (`#3291 <https://github.com/pytest-dev/pytest/issues/3291>`_)
148+
149+
- Internal refactoring of ``FormattedExcinfo`` to use ``attrs`` facilities and
150+
remove old support code for legacy Python versions. (`#3292
151+
<https://github.com/pytest-dev/pytest/issues/3292>`_)
152+
153+
- Refactoring to unify how verbosity is handled internally. (`#3296
154+
<https://github.com/pytest-dev/pytest/issues/3296>`_)
155+
156+
- Internal refactoring to better integrate with argparse. (`#3304
157+
<https://github.com/pytest-dev/pytest/issues/3304>`_)
158+
159+
- Fix a python example when calling a fixture in doc/en/usage.rst (`#3308
160+
<https://github.com/pytest-dev/pytest/issues/3308>`_)
161+
162+
11163
Pytest 3.4.2 (2018-03-04)
12164
=========================
13165

changelog/3245.trivial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Added ``doc`` to norecursedirs in tox.ini
1+
Renamed example directories so all tests pass when ran from the base directory.

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-3.5.0
910
release-3.4.2
1011
release-3.4.1
1112
release-3.4.0

doc/en/announce/release-3.5.0.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
pytest-3.5.0
2+
=======================================
3+
4+
The pytest team is proud to announce the 3.5.0 release!
5+
6+
pytest is a mature Python testing tool with more than a 1600 tests
7+
against itself, passing on many different interpreters and platforms.
8+
9+
This release contains a number of bugs fixes and improvements, so users are encouraged
10+
to take a look at the CHANGELOG:
11+
12+
http://doc.pytest.org/en/latest/changelog.html
13+
14+
For complete documentation, please visit:
15+
16+
http://docs.pytest.org
17+
18+
As usual, you can upgrade from pypi via:
19+
20+
pip install -U pytest
21+
22+
Thanks to all who contributed to this release, among them:
23+
24+
* Allan Feldman
25+
* Brian Maissy
26+
* Bruno Oliveira
27+
* Carlos Jenkins
28+
* Daniel Hahler
29+
* Florian Bruhin
30+
* Jason R. Coombs
31+
* Jeffrey Rackauckas
32+
* Jordan Speicher
33+
* Julien Palard
34+
* Kale Kundert
35+
* Kostis Anagnostopoulos
36+
* Kyle Altendorf
37+
* Maik Figura
38+
* Pedro Algarvio
39+
* Ronny Pfannschmidt
40+
* Tadeu Manoel
41+
* Tareq Alayan
42+
* Thomas Hisch
43+
* William Lee
44+
* codetriage-readme-bot
45+
* feuillemorte
46+
* joshm91
47+
* mike
48+
49+
50+
Happy testing,
51+
The Pytest Development Team

doc/en/builtin.rst

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,106 @@ For information on the ``pytest.mark`` mechanism, see :ref:`mark`.
1515
For information about fixtures, see :ref:`fixtures`. To see a complete list of available fixtures, type::
1616

1717
$ pytest -q --fixtures
18-
18+
cache
19+
Return a cache object that can persist state between testing sessions.
20+
21+
cache.get(key, default)
22+
cache.set(key, value)
23+
24+
Keys must be a ``/`` separated value, where the first part is usually the
25+
name of your plugin or application to avoid clashes with other cache users.
26+
27+
Values can be any object handled by the json stdlib module.
28+
capsys
29+
Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make
30+
captured output available via ``capsys.readouterr()`` method calls
31+
which return a ``(out, err)`` namedtuple. ``out`` and ``err`` will be ``text``
32+
objects.
33+
capsysbinary
34+
Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make
35+
captured output available via ``capsys.readouterr()`` method calls
36+
which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``bytes``
37+
objects.
38+
capfd
39+
Enable capturing of writes to file descriptors ``1`` and ``2`` and make
40+
captured output available via ``capfd.readouterr()`` method calls
41+
which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``text``
42+
objects.
43+
capfdbinary
44+
Enable capturing of write to file descriptors 1 and 2 and make
45+
captured output available via ``capfdbinary.readouterr`` method calls
46+
which return a ``(out, err)`` tuple. ``out`` and ``err`` will be
47+
``bytes`` objects.
48+
doctest_namespace
49+
Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests.
50+
pytestconfig
51+
Session-scoped fixture that returns the :class:`_pytest.config.Config` object.
52+
53+
Example::
54+
55+
def test_foo(pytestconfig):
56+
if pytestconfig.getoption("verbose"):
57+
...
58+
record_property
59+
Add an extra properties the calling test.
60+
User properties become part of the test report and are available to the
61+
configured reporters, like JUnit XML.
62+
The fixture is callable with ``(name, value)``, with value being automatically
63+
xml-encoded.
64+
65+
Example::
66+
67+
def test_function(record_property):
68+
record_property("example_key", 1)
69+
record_xml_property
70+
(Deprecated) use record_property.
71+
record_xml_attribute
72+
Add extra xml attributes to the tag for the calling test.
73+
The fixture is callable with ``(name, value)``, with value being
74+
automatically xml-encoded
75+
caplog
76+
Access and control log capturing.
77+
78+
Captured logs are available through the following methods::
79+
80+
* caplog.text() -> string containing formatted log output
81+
* caplog.records() -> list of logging.LogRecord instances
82+
* caplog.record_tuples() -> list of (logger_name, level, message) tuples
83+
* caplog.clear() -> clear captured records and formatted log output string
84+
monkeypatch
85+
The returned ``monkeypatch`` fixture provides these
86+
helper methods to modify objects, dictionaries or os.environ::
87+
88+
monkeypatch.setattr(obj, name, value, raising=True)
89+
monkeypatch.delattr(obj, name, raising=True)
90+
monkeypatch.setitem(mapping, name, value)
91+
monkeypatch.delitem(obj, name, raising=True)
92+
monkeypatch.setenv(name, value, prepend=False)
93+
monkeypatch.delenv(name, value, raising=True)
94+
monkeypatch.syspath_prepend(path)
95+
monkeypatch.chdir(path)
96+
97+
All modifications will be undone after the requesting
98+
test function or fixture has finished. The ``raising``
99+
parameter determines if a KeyError or AttributeError
100+
will be raised if the set/deletion operation has no target.
101+
recwarn
102+
Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
103+
104+
See http://docs.python.org/library/warnings.html for information
105+
on warning categories.
106+
tmpdir_factory
107+
Return a TempdirFactory instance for the test session.
108+
tmpdir
109+
Return a temporary directory path object
110+
which is unique to each test function invocation,
111+
created as a sub directory of the base temporary
112+
directory. The returned object is a `py.path.local`_
113+
path object.
114+
115+
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
116+
117+
no tests ran in 0.12 seconds
19118

20119
You can also interactively ask for help, e.g. by typing on the Python interactive prompt something like::
21120

doc/en/cache.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ If you then run it with ``--lf``::
7878
=========================== test session starts ============================
7979
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
8080
rootdir: $REGENDOC_TMPDIR, inifile:
81-
collected 50 items
81+
collected 50 items / 48 deselected
8282
run-last-failure: rerun previous 2 failures
8383
8484
test_50.py FF [100%]
@@ -106,7 +106,6 @@ If you then run it with ``--lf``::
106106
E Failed: bad luck
107107
108108
test_50.py:6: Failed
109-
=========================== 48 tests deselected ============================
110109
================= 2 failed, 48 deselected in 0.12 seconds ==================
111110

112111
You have run only the two failing test from the last run, while 48 tests have
@@ -243,6 +242,8 @@ You can always peek at the content of the cache using the
243242
------------------------------- cache values -------------------------------
244243
cache/lastfailed contains:
245244
{'test_caching.py::test_function': True}
245+
cache/nodeids contains:
246+
['test_caching.py::test_function']
246247
example/value contains:
247248
42
248249

0 commit comments

Comments
 (0)