=========================================================================
Deprecations
------------
- :issue:`3616`: The following accesses have been documented as deprecated for years, but are now actually emitting deprecation warnings.
* Access of ``Module``, ``Function``, ``Class``, ``Instance``, ``File`` and ``Item`` through ``Node`` instances. Now
users will this warning::
usage of Function.Module is deprecated, please use pytest.Module instead
Users should just ``import pytest`` and access those objects using the ``pytest`` module.
* ``request.cached_setup``, this was the precursor of the setup/teardown mechanism available to fixtures. You can
consult :std:doc:`funcarg comparison section in the docs <funcarg_compare>`.
* Using objects named ``"Class"`` as a way to customize the type of nodes that are collected in ``Collector``
subclasses has been deprecated. Users instead should use ``pytest_collect_make_item`` to customize node types during
collection.
This issue should affect only advanced plugins who create new collection types, so if you see this warning
message please contact the authors so they can change the code.
* The warning that produces the message below has changed to ``RemovedInPytest4Warning``::
getfuncargvalue is deprecated, use getfixturevalue
- :issue:`3988`: Add a Deprecation warning for pytest.ensuretemp as it was deprecated since a while.
Features
--------
- :issue:`2293`: Improve usage errors messages by hiding internal details which can be distracting and noisy.
This has the side effect that some error conditions that previously raised generic errors (such as
``ValueError`` for unregistered marks) are now raising ``Failed`` exceptions.
- :issue:`3332`: Improve the error displayed when a ``conftest.py`` file could not be imported.
In order to implement this, a new ``chain`` parameter was added to ``ExceptionInfo.getrepr``
to show or hide chained tracebacks in Python 3 (defaults to ``True``).
- :issue:`3849`: Add ``empty_parameter_set_mark=fail_at_collect`` ini option for raising an exception when parametrize collects an empty set.
- :issue:`3964`: Log messages generated in the collection phase are shown when
live-logging is enabled and/or when they are logged to a file.
- :issue:`3985`: Introduce ``tmp_path`` as a fixture providing a Path object. Also introduce ``tmp_path_factory`` as
a session-scoped fixture for creating arbitrary temporary directories from any other fixture or test.
- :issue:`4013`: Deprecation warnings are now shown even if you customize the warnings filters yourself. In the previous version
any customization would override pytest's filters and deprecation warnings would fall back to being hidden by default.
- :issue:`4073`: Allow specification of timeout for ``Testdir.runpytest_subprocess()`` and ``Testdir.run()``.
- :issue:`4098`: Add returncode argument to pytest.exit() to exit pytest with a specific return code.
- :issue:`4102`: Reimplement ``pytest.deprecated_call`` using ``pytest.warns`` so it supports the ``match='...'`` keyword argument.
This has the side effect that ``pytest.deprecated_call`` now raises ``pytest.fail.Exception`` instead
of ``AssertionError``.
- :issue:`4149`: Require setuptools>=30.3 and move most of the metadata to ``setup.cfg``.
Bug Fixes
---------
- :issue:`2535`: Improve error message when test functions of ``unittest.TestCase`` subclasses use a parametrized fixture.
- :issue:`3057`: ``request.fixturenames`` now correctly returns the name of fixtures created by ``request.getfixturevalue()``.
- :issue:`3946`: Warning filters passed as command line options using ``-W`` now take precedence over filters defined in ``ini``
configuration files.
- :issue:`4066`: Fix source reindenting by using ``textwrap.dedent`` directly.
- :issue:`4102`: ``pytest.warn`` will capture previously-warned warnings in Python 2. Previously they were never raised.
- :issue:`4108`: Resolve symbolic links for args.
This fixes running ``pytest tests/test_foo.py::test_bar``, where ``tests``
is a symlink to ``project/app/tests``:
previously ``project/app/conftest.py`` would be ignored for fixtures then.
- :issue:`4132`: Fix duplicate printing of internal errors when using ``--pdb``.
- :issue:`4135`: pathlib based tmpdir cleanup now correctly handles symlinks in the folder.
- :issue:`4152`: Display the filename when encountering ``SyntaxWarning``.
Improved Documentation
----------------------
- :issue:`3713`: Update usefixtures documentation to clarify that it can't be used with fixture functions.
- :issue:`4058`: Update fixture documentation to specify that a fixture can be invoked twice in the scope it's defined for.
- :issue:`4064`: According to unittest.rst, setUpModule and tearDownModule were not implemented, but it turns out they are. So updated the documentation for unittest.
- :issue:`4151`: Add tempir testing example to CONTRIBUTING.rst guide
Trivial/Internal Changes
------------------------
- :issue:`2293`: The internal ``MarkerError`` exception has been removed.
- :issue:`3988`: Port the implementation of tmpdir to pathlib.
- :issue:`4063`: Exclude 0.00 second entries from ``--duration`` output unless ``-vv`` is passed on the command-line.
- :issue:`4093`: Fixed formatting of string literals in internal tests.