Pytest

Latest version: v8.2.0

Safety actively analyzes 630305 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 18 of 33

3.6.2

=========================

Bug Fixes
---------

- Fix regression in ``Node.add_marker`` by extracting the mark object of a
``MarkDecorator``. (:issue:`3555`)

- Warnings without ``location`` were reported as ``None``. This is corrected to
now report ``<undetermined location>``. (:issue:`3563`)

- Continue to call finalizers in the stack when a finalizer in a former scope
raises an exception. (:issue:`3569`)

- Fix encoding error with ``print`` statements in doctests (:issue:`3583`)


Improved Documentation
----------------------

- Add documentation for the ``--strict`` flag. (:issue:`3549`)


Trivial/Internal Changes
------------------------

- Update old quotation style to parens in fixture.rst documentation. (:issue:`3525`)

- Improve display of hint about ``--fulltrace`` with ``KeyboardInterrupt``.
(:issue:`3545`)

- pytest's testsuite is no longer runnable through ``python setup.py test`` --
instead invoke ``pytest`` or ``tox`` directly. (:issue:`3552`)

- Fix typo in documentation (:issue:`3567`)

3.6.1

=========================

Bug Fixes
---------

- Fixed a bug where stdout and stderr were logged twice by junitxml when a test
was marked xfail. (:issue:`3491`)

- Fix ``usefixtures`` mark applied to unittest tests by correctly instantiating
``FixtureInfo``. (:issue:`3498`)

- Fix assertion rewriter compatibility with libraries that monkey patch
``file`` objects. (:issue:`3503`)


Improved Documentation
----------------------

- Added a section on how to use fixtures as factories to the fixture
documentation. (:issue:`3461`)


Trivial/Internal Changes
------------------------

- Enable caching for pip/pre-commit in order to reduce build time on
travis/appveyor. (:issue:`3502`)

- Switch pytest to the src/ layout as we already suggested it for good practice
- now we implement it as well. (:issue:`3513`)

- Fix if in tests to support 3.7.0b5, where a docstring handling in AST got
reverted. (:issue:`3530`)

- Remove some python2.5 compatibility code. (:issue:`3529`)

3.6.0

=========================

Features
--------

- Revamp the internals of the ``pytest.mark`` implementation with correct per
node handling which fixes a number of long standing bugs caused by the old
design. This introduces new ``Node.iter_markers(name)`` and
``Node.get_closest_marker(name)`` APIs. Users are **strongly encouraged** to
read the :ref:`reasons for the revamp in the docs <marker-revamp>`,
or jump over to details about :ref:`updating existing code to use the new APIs
<update marker code>`.
(:issue:`3317`)

- Now when ``pytest.fixture`` is applied more than once to the same function a
``ValueError`` is raised. This buggy behavior would cause surprising problems
and if was working for a test suite it was mostly by accident. (:issue:`2334`)

- Support for Python 3.7's builtin ``breakpoint()`` method, see
:ref:`Using the builtin breakpoint function <breakpoint-builtin>` for
details. (:issue:`3180`)

- ``monkeypatch`` now supports a ``context()`` function which acts as a context
manager which undoes all patching done within the ``with`` block. (:issue:`3290`)

- The ``--pdb`` option now causes KeyboardInterrupt to enter the debugger,
instead of stopping the test session. On python 2.7, hitting CTRL+C again
exits the debugger. On python 3.2 and higher, use CTRL+D. (:issue:`3299`)

- pytest no longer changes the log level of the root logger when the
``log-level`` parameter has greater numeric value than that of the level of
the root logger, which makes it play better with custom logging configuration
in user code. (:issue:`3307`)


Bug Fixes
---------

- A rare race-condition which might result in corrupted ``.pyc`` files on
Windows has been hopefully solved. (:issue:`3008`)

- Also use iter_marker for discovering the marks applying for marker
expressions from the cli to avoid the bad data from the legacy mark storage.
(:issue:`3441`)

- When showing diffs of failed assertions where the contents contain only
whitespace, escape them using ``repr()`` first to make it easy to spot the
differences. (:issue:`3443`)


Improved Documentation
----------------------

- Change documentation copyright year to a range which auto-updates itself each
time it is published. (:issue:`3303`)


Trivial/Internal Changes
------------------------

- ``pytest`` now depends on the `python-atomicwrites
<https://github.com/untitaker/python-atomicwrites>`_ library. (:issue:`3008`)

- Update all pypi.python.org URLs to pypi.org. (:issue:`3431`)

- Detect `pytest_` prefixed hooks using the internal plugin manager since
``pluggy`` is deprecating the ``implprefix`` argument to ``PluginManager``.
(:issue:`3487`)

- Import ``Mapping`` and ``Sequence`` from ``_pytest.compat`` instead of
directly from ``collections`` in ``python_api.py::approx``. Add ``Mapping``
to ``_pytest.compat``, import it from ``collections`` on python 2, but from
``collections.abc`` on Python 3 to avoid a ``DeprecationWarning`` on Python
3.7 or newer. (:issue:`3497`)

3.5.1

=========================


Bug Fixes
---------

- Reset ``sys.last_type``, ``sys.last_value`` and ``sys.last_traceback`` before
each test executes. Those attributes are added by pytest during the test run
to aid debugging, but were never reset so they would create a leaking
reference to the last failing test's frame which in turn could never be
reclaimed by the garbage collector. (:issue:`2798`)

- ``pytest.raises`` now raises ``TypeError`` when receiving an unknown keyword
argument. (:issue:`3348`)

- ``pytest.raises`` now works with exception classes that look like iterables.
(:issue:`3372`)


Improved Documentation
----------------------

- Fix typo in ``caplog`` fixture documentation, which incorrectly identified
certain attributes as methods. (:issue:`3406`)


Trivial/Internal Changes
------------------------

- Added a more indicative error message when parametrizing a function whose
argument takes a default value. (:issue:`3221`)

- Remove internal ``_pytest.terminal.flatten`` function in favor of
``more_itertools.collapse``. (:issue:`3330`)

- Import some modules from ``collections.abc`` instead of ``collections`` as
the former modules trigger ``DeprecationWarning`` in Python 3.7. (:issue:`3339`)

- record_property is no longer experimental, removing the warnings was
forgotten. (:issue:`3360`)

- Mention in documentation and CLI help that fixtures with leading ``_`` are
printed by ``pytest --fixtures`` only if the ``-v`` option is added. (:issue:`3398`)

3.5.0

=========================

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`)

3.4.2

=========================

Bug Fixes
---------

- Removed progress information when capture option is ``no``. (:issue:`3203`)

- Refactor check of bindir from ``exists`` to ``isdir``. (:issue:`3241`)

- Fix ``TypeError`` issue when using ``approx`` with a ``Decimal`` value.
(:issue:`3247`)

- Fix reference cycle generated when using the ``request`` fixture. (:issue:`3249`)

- ``[tool:pytest]`` sections in ``*.cfg`` files passed by the ``-c`` option are
now properly recognized. (:issue:`3260`)


Improved Documentation
----------------------

- Add logging plugin to plugins list. (:issue:`3209`)


Trivial/Internal Changes
------------------------

- Fix minor typo in fixture.rst (:issue:`3259`)

Page 18 of 33

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.