=========================
Deprecations and Removals
-------------------------
- pytest no longer supports Python **2.6** and **3.3**. Those Python versions
are EOL for some time now and incur maintenance and compatibility costs on
the pytest core team, and following up with the rest of the community we
decided that they will no longer be supported starting on this version. Users
which still require those versions should pin pytest to ``<3.3``. (:issue:`2812`)
- Remove internal ``_preloadplugins()`` function. This removal is part of the
``pytest_namespace()`` hook deprecation. (:issue:`2636`)
- Internally change ``CallSpec2`` to have a list of marks instead of a broken
mapping of keywords. This removes the keywords attribute of the internal
``CallSpec2`` class. (:issue:`2672`)
- Remove ParameterSet.deprecated_arg_dict - its not a public api and the lack
of the underscore was a naming error. (:issue:`2675`)
- Remove the internal multi-typed attribute ``Node._evalskip`` and replace it
with the boolean ``Node._skipped_by_mark``. (:issue:`2767`)
- The ``params`` list passed to ``pytest.fixture`` is now for
all effects considered immutable and frozen at the moment of the ``pytest.fixture``
call. Previously the list could be changed before the first invocation of the fixture
allowing for a form of dynamic parametrization (for example, updated from command-line options),
but this was an unwanted implementation detail which complicated the internals and prevented
some internal cleanup. See issue :issue:`2959`
for details and a recommended workaround.
Features
--------
- ``pytest_fixture_post_finalizer`` hook can now receive a ``request``
argument. (:issue:`2124`)
- Replace the old introspection code in compat.py that determines the available
arguments of fixtures with inspect.signature on Python 3 and
funcsigs.signature on Python 2. This should respect ``__signature__``
declarations on functions. (:issue:`2267`)
- Report tests with global ``pytestmark`` variable only once. (:issue:`2549`)
- Now pytest displays the total progress percentage while running tests. The
previous output style can be set by configuring the ``console_output_style``
setting to ``classic``. (:issue:`2657`)
- Match ``warns`` signature to ``raises`` by adding ``match`` keyword. (:issue:`2708`)
- pytest now captures and displays output from the standard ``logging`` module.
The user can control the logging level to be captured by specifying options
in ``pytest.ini``, the command line and also during individual tests using
markers. Also, a ``caplog`` fixture is available that enables users to test
the captured log during specific tests (similar to ``capsys`` for example).
For more information, please see the :doc:`logging docs <how-to/logging>`. This feature was
introduced by merging the popular :pypi:`pytest-catchlog` plugin, thanks to :user:`thisch`.
Be advised that during the merging the
backward compatibility interface with the defunct ``pytest-capturelog`` has
been dropped. (:issue:`2794`)
- Add ``allow_module_level`` kwarg to ``pytest.skip()``, enabling to skip the
whole module. (:issue:`2808`)
- Allow setting ``file_or_dir``, ``-c``, and ``-o`` in PYTEST_ADDOPTS. (:issue:`2824`)
- Return stdout/stderr capture results as a ``namedtuple``, so ``out`` and
``err`` can be accessed by attribute. (:issue:`2879`)
- Add ``capfdbinary``, a version of ``capfd`` which returns bytes from
``readouterr()``. (:issue:`2923`)
- Add ``capsysbinary`` a version of ``capsys`` which returns bytes from
``readouterr()``. (:issue:`2934`)
- Implement feature to skip ``setup.py`` files when run with
``--doctest-modules``. (:issue:`502`)
Bug Fixes
---------
- Resume output capturing after ``capsys/capfd.disabled()`` context manager.
(:issue:`1993`)
- ``pytest_fixture_setup`` and ``pytest_fixture_post_finalizer`` hooks are now
called for all ``conftest.py`` files. (:issue:`2124`)
- If an exception happens while loading a plugin, pytest no longer hides the
original traceback. In Python 2 it will show the original traceback with a new
message that explains in which plugin. In Python 3 it will show 2 canonized
exceptions, the original exception while loading the plugin in addition to an
exception that pytest throws about loading a plugin. (:issue:`2491`)
- ``capsys`` and ``capfd`` can now be used by other fixtures. (:issue:`2709`)
- Internal ``pytester`` plugin properly encodes ``bytes`` arguments to
``utf-8``. (:issue:`2738`)
- ``testdir`` now uses use the same method used by ``tmpdir`` to create its
temporary directory. This changes the final structure of the ``testdir``
directory slightly, but should not affect usage in normal scenarios and
avoids a number of potential problems. (:issue:`2751`)
- pytest no longer complains about warnings with unicode messages being
non-ascii compatible even for ascii-compatible messages. As a result of this,
warnings with unicode messages are converted first to an ascii representation
for safety. (:issue:`2809`)
- Change return value of pytest command when ``--maxfail`` is reached from
``2`` (interrupted) to ``1`` (failed). (:issue:`2845`)
- Fix issue in assertion rewriting which could lead it to rewrite modules which
should not be rewritten. (:issue:`2939`)
- Handle marks without description in ``pytest.ini``. (:issue:`2942`)
Trivial/Internal Changes
------------------------
- pytest now depends on :pypi:`attrs` for internal
structures to ease code maintainability. (:issue:`2641`)
- Refactored internal Python 2/3 compatibility code to use ``six``. (:issue:`2642`)
- Stop vendoring ``pluggy`` - we're missing out on its latest changes for not
much benefit (:issue:`2719`)
- Internal refactor: simplify ascii string escaping by using the
backslashreplace error handler in newer Python 3 versions. (:issue:`2734`)
- Remove unnecessary mark evaluator in unittest plugin (:issue:`2767`)
- Calls to ``Metafunc.addcall`` now emit a deprecation warning. This function
is scheduled to be removed in ``pytest-4.0``. (:issue:`2876`)
- Internal move of the parameterset extraction to a more maintainable place.
(:issue:`2877`)
- Internal refactoring to simplify scope node lookup. (:issue:`2910`)
- Configure ``pytest`` to prevent pip from installing pytest in unsupported
Python versions. (:issue:`2922`)