=========================
Deprecations and Removals
-------------------------
- ``record_xml_property`` fixture is now deprecated in favor of the more
generic ``record_property``. (:issue:`2770`)
- Defining ``pytest_plugins`` is now deprecated in non-top-level conftest.py
files, because they "leak" to the entire directory tree.
:ref:`See the docs <pytest_plugins in non-top-level conftest files deprecated>`
for the rationale behind this decision (:issue:`3084`)
Features
--------
- New ``--show-capture`` command-line option that allows to specify how to
display captured output when tests fail: ``no``, ``stdout``, ``stderr``,
``log`` or ``all`` (the default). (:issue:`1478`)
- New ``--rootdir`` command-line option to override the rules for discovering
the root directory. See :doc:`customize <reference/customize>` in the documentation for
details. (:issue:`1642`)
- Fixtures are now instantiated based on their scopes, with higher-scoped
fixtures (such as ``session``) being instantiated first than lower-scoped
fixtures (such as ``function``). The relative order of fixtures of the same
scope is kept unchanged, based in their declaration order and their
dependencies. (:issue:`2405`)
- ``record_xml_property`` renamed to ``record_property`` and is now compatible
with xdist, markers and any reporter. ``record_xml_property`` name is now
deprecated. (:issue:`2770`)
- New ``--nf``, ``--new-first`` options: run new tests first followed by the
rest of the tests, in both cases tests are also sorted by the file modified
time, with more recent files coming first. (:issue:`3034`)
- New ``--last-failed-no-failures`` command-line option that allows to specify
the behavior of the cache plugin's --last-failed`` feature when no tests
failed in the last run (or no cache was found): ``none`` or ``all`` (the
default). (:issue:`3139`)
- New ``--doctest-continue-on-failure`` command-line option to enable doctests
to show multiple failures for each snippet, instead of stopping at the first
failure. (:issue:`3149`)
- Captured log messages are added to the ``<system-out>`` tag in the generated
junit xml file if the ``junit_logging`` ini option is set to ``system-out``.
If the value of this ini option is ``system-err``, the logs are written to
``<system-err>``. The default value for ``junit_logging`` is ``no``, meaning
captured logs are not written to the output file. (:issue:`3156`)
- Allow the logging plugin to handle ``pytest_runtest_logstart`` and
``pytest_runtest_logfinish`` hooks when live logs are enabled. (:issue:`3189`)
- Passing ``--log-cli-level`` in the command-line now automatically activates
live logging. (:issue:`3190`)
- Add command line option ``--deselect`` to allow deselection of individual
tests at collection time. (:issue:`3198`)
- Captured logs are printed before entering pdb. (:issue:`3204`)
- Deselected item count is now shown before tests are run, e.g. ``collected X
items / Y deselected``. (:issue:`3213`)
- The builtin module ``platform`` is now available for use in expressions in
``pytest.mark``. (:issue:`3236`)
- The *short test summary info* section now is displayed after tracebacks and
warnings in the terminal. (:issue:`3255`)
- New ``--verbosity`` flag to set verbosity level explicitly. (:issue:`3296`)
- ``pytest.approx`` now accepts comparing a numpy array with a scalar. (:issue:`3312`)
Bug Fixes
---------
- Suppress ``IOError`` when closing the temporary file used for capturing
streams in Python 2.7. (:issue:`2370`)
- Fixed ``clear()`` method on ``caplog`` fixture which cleared ``records``, but
not the ``text`` property. (:issue:`3297`)
- During test collection, when stdin is not allowed to be read, the
``DontReadFromStdin`` object still allow itself to be iterable and resolved
to an iterator without crashing. (:issue:`3314`)
Improved Documentation
----------------------
- Added a :doc:`reference <reference/reference>` page
to the docs. (:issue:`1713`)
Trivial/Internal Changes
------------------------
- Change minimum requirement of ``attrs`` to ``17.4.0``. (:issue:`3228`)
- Renamed example directories so all tests pass when ran from the base
directory. (:issue:`3245`)
- Internal ``mark.py`` module has been turned into a package. (:issue:`3250`)
- ``pytest`` now depends on the `more-itertools
<https://github.com/erikrose/more-itertools>`_ package. (:issue:`3265`)
- Added warning when ``[pytest]`` section is used in a ``.cfg`` file passed
with ``-c`` (:issue:`3268`)
- ``nodeids`` can now be passed explicitly to ``FSCollector`` and ``Node``
constructors. (:issue:`3291`)
- Internal refactoring of ``FormattedExcinfo`` to use ``attrs`` facilities and
remove old support code for legacy Python versions. (:issue:`3292`)
- Refactoring to unify how verbosity is handled internally. (:issue:`3296`)
- Internal refactoring to better integrate with argparse. (:issue:`3304`)
- Fix a python example when calling a fixture in doc/en/usage.rst (:issue:`3308`)