Pytest

Latest version: v8.2.0

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

Scan your dependencies

Page 20 of 33

3.2.4

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

Bug Fixes
---------

- Fix the bug where running with ``--pyargs`` will result in items with
empty ``parent.nodeid`` if run from a different root directory. (:issue:`2775`)

- Fix issue with ``pytest.parametrize`` if argnames was specified as keyword arguments.
(:issue:`2819`)

- Strip whitespace from marker names when reading them from INI config. (:issue:`2856`)

- Show full context of doctest source in the pytest output, if the line number of
failed example in the docstring is < 9. (:issue:`2882`)

- Match fixture paths against actual path segments in order to avoid matching folders which share a prefix.
(:issue:`2836`)

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

- Introduce a dedicated section about conftest.py. (:issue:`1505`)

- Explicitly mention ``xpass`` in the documentation of ``xfail``. (:issue:`1997`)

- Append example for pytest.param in the example/parametrize document. (:issue:`2658`)

- Clarify language of proposal for fixtures parameters (:issue:`2893`)

- List python 3.6 in the documented supported versions in the getting started
document. (:issue:`2903`)

- Clarify the documentation of available fixture scopes. (:issue:`538`)

- Add documentation about the ``python -m pytest`` invocation adding the
current directory to sys.path. (:issue:`911`)

3.2.3

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

Bug Fixes
---------

- Fix crash in tab completion when no prefix is given. (:issue:`2748`)

- The equality checking function (``__eq__``) of ``MarkDecorator`` returns
``False`` if one object is not an instance of ``MarkDecorator``. (:issue:`2758`)

- When running ``pytest --fixtures-per-test``: don't crash if an item has no
_fixtureinfo attribute (e.g. doctests) (:issue:`2788`)


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

- In help text of ``-k`` option, add example of using ``not`` to not select
certain tests whose names match the provided expression. (:issue:`1442`)

- Add note in ``parametrize.rst`` about calling ``metafunc.parametrize``
multiple times. (:issue:`1548`)


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

- Set ``xfail_strict=True`` in pytest's own test suite to catch expected
failures as soon as they start to pass. (:issue:`2722`)

- Fix typo in example of passing a callable to markers (in example/markers.rst)
(:issue:`2765`)

3.2.2

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

Bug Fixes
---------

- Calling the deprecated ``request.getfuncargvalue()`` now shows the source of
the call. (:issue:`2681`)

- Allow tests declared as ``staticmethod`` to use fixtures. (:issue:`2699`)

- Fixed edge-case during collection: attributes which raised ``pytest.fail``
when accessed would abort the entire collection. (:issue:`2707`)

- Fix ``ReprFuncArgs`` with mixed unicode and UTF-8 args. (:issue:`2731`)


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

- In examples on working with custom markers, add examples demonstrating the
usage of ``pytest.mark.MARKER_NAME.with_args`` in comparison with
``pytest.mark.MARKER_NAME.__call__`` (:issue:`2604`)

- In one of the simple examples, use ``pytest_collection_modifyitems()`` to skip
tests based on a command-line option, allowing its sharing while preventing a
user error when accessing ``pytest.config`` before the argument parsing.
(:issue:`2653`)


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

- Fixed minor error in 'Good Practices/Manual Integration' code snippet.
(:issue:`2691`)

- Fixed typo in goodpractices.rst. (:issue:`2721`)

- Improve user guidance regarding ``--resultlog`` deprecation. (:issue:`2739`)

3.2.1

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

Bug Fixes
---------

- Fixed small terminal glitch when collecting a single test item. (:issue:`2579`)

- Correctly consider ``/`` as the file separator to automatically mark plugin
files for rewrite on Windows. (:issue:`2591`)

- Properly escape test names when setting ``PYTEST_CURRENT_TEST`` environment
variable. (:issue:`2644`)

- Fix error on Windows and Python 3.6+ when ``sys.stdout`` has been replaced
with a stream-like object which does not implement the full ``io`` module
buffer protocol. In particular this affects ``pytest-xdist`` users on the
aforementioned platform. (:issue:`2666`)


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

- Explicitly document which pytest features work with ``unittest``. (:issue:`2626`)

3.2.0

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

Deprecations and Removals
-------------------------

- ``pytest.approx`` no longer supports ``>``, ``>=``, ``<`` and ``<=``
operators to avoid surprising/inconsistent behavior. See the :func:`~pytest.approx` docs for more
information. (:issue:`2003`)

- All old-style specific behavior in current classes in the pytest's API is
considered deprecated at this point and will be removed in a future release.
This affects Python 2 users only and in rare situations. (:issue:`2147`)

- A deprecation warning is now raised when using marks for parameters
in ``pytest.mark.parametrize``. Use ``pytest.param`` to apply marks to
parameters instead. (:issue:`2427`)


Features
--------

- Add support for numpy arrays (and dicts) to approx. (:issue:`1994`)

- Now test function objects have a ``pytestmark`` attribute containing a list
of marks applied directly to the test function, as opposed to marks inherited
from parent classes or modules. (:issue:`2516`)

- Collection ignores local virtualenvs by default; ``--collect-in-virtualenv``
overrides this behavior. (:issue:`2518`)

- Allow class methods decorated as ``staticmethod`` to be candidates for
collection as a test function. (Only for Python 2.7 and above. Python 2.6
will still ignore static methods.) (:issue:`2528`)

- Introduce ``mark.with_args`` in order to allow passing functions/classes as
sole argument to marks. (:issue:`2540`)

- New ``cache_dir`` ini option: sets the directory where the contents of the
cache plugin are stored. Directory may be relative or absolute path: if relative path, then
directory is created relative to ``rootdir``, otherwise it is used as is.
Additionally path may contain environment variables which are expanded during
runtime. (:issue:`2543`)

- Introduce the ``PYTEST_CURRENT_TEST`` environment variable that is set with
the ``nodeid`` and stage (``setup``, ``call`` and ``teardown``) of the test
being currently executed. See the :ref:`documentation <pytest current test env>`
for more info. (:issue:`2583`)

- Introduced ``pytest.mark.filterwarnings`` mark which allows overwriting the
warnings filter on a per test, class or module level. See the :ref:`docs <filterwarnings>`
for more information. (:issue:`2598`)

- ``--last-failed`` now remembers forever when a test has failed and only
forgets it if it passes again. This makes it easy to fix a test suite by
selectively running files and fixing tests incrementally. (:issue:`2621`)

- New ``pytest_report_collectionfinish`` hook which allows plugins to add
messages to the terminal reporting after collection has been finished
successfully. (:issue:`2622`)

- Added support for :pep:`415`\'s
``Exception.__suppress_context__``. Now if a ``raise exception from None`` is
caught by pytest, pytest will no longer chain the context in the test report.
The behavior now matches Python's traceback behavior. (:issue:`2631`)

- Exceptions raised by ``pytest.fail``, ``pytest.skip`` and ``pytest.xfail``
now subclass BaseException, making them harder to be caught unintentionally
by normal code. (:issue:`580`)


Bug Fixes
---------

- Set ``stdin`` to a closed ``PIPE`` in ``pytester.py.Testdir.popen()`` for
avoid unwanted interactive ``pdb`` (:issue:`2023`)

- Add missing ``encoding`` attribute to ``sys.std*`` streams when using
``capsys`` capture mode. (:issue:`2375`)

- Fix terminal color changing to black on Windows if ``colorama`` is imported
in a ``conftest.py`` file. (:issue:`2510`)

- Fix line number when reporting summary of skipped tests. (:issue:`2548`)

- capture: ensure that EncodedFile.name is a string. (:issue:`2555`)

- The options ``--fixtures`` and ``--fixtures-per-test`` will now keep
indentation within docstrings. (:issue:`2574`)

- doctests line numbers are now reported correctly, fixing `pytest-sugar122
<https://github.com/Frozenball/pytest-sugar/issues/122>`_. (:issue:`2610`)

- Fix non-determinism in order of fixture collection. Adds new dependency
(ordereddict) for Python 2.6. (:issue:`920`)


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

- Clarify ``pytest_configure`` hook call order. (:issue:`2539`)

- Extend documentation for testing plugin code with the ``pytester`` plugin.
(:issue:`971`)


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

- Update help message for ``--strict`` to make it clear it only deals with
unregistered markers, not warnings. (:issue:`2444`)

- Internal code move: move code for pytest.approx/pytest.raises to own files in
order to cut down the size of python.py (:issue:`2489`)

- Renamed the utility function ``_pytest.compat._escape_strings`` to
``_ascii_escaped`` to better communicate the function's purpose. (:issue:`2533`)

- Improve error message for CollectError with skip/skipif. (:issue:`2546`)

- Emit warning about ``yield`` tests being deprecated only once per generator.
(:issue:`2562`)

- Ensure final collected line doesn't include artifacts of previous write.
(:issue:`2571`)

- Fixed all flake8 errors and warnings. (:issue:`2581`)

- Added ``fix-lint`` tox environment to run automatic pep8 fixes on the code.
(:issue:`2582`)

- Turn warnings into errors in pytest's own test suite in order to catch
regressions due to deprecations more promptly. (:issue:`2588`)

- Show multiple issue links in CHANGELOG entries. (:issue:`2620`)

3.1.3

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

Bug Fixes
---------

- Fix decode error in Python 2 for doctests in docstrings. (:issue:`2434`)

- Exceptions raised during teardown by finalizers are now suppressed until all
finalizers are called, with the initial exception reraised. (:issue:`2440`)

- Fix incorrect "collected items" report when specifying tests on the command-
line. (:issue:`2464`)

- ``deprecated_call`` in context-manager form now captures deprecation warnings
even if the same warning has already been raised. Also, ``deprecated_call``
will always produce the same error message (previously it would produce
different messages in context-manager vs. function-call mode). (:issue:`2469`)

- Fix issue where paths collected by pytest could have triple leading ``/``
characters. (:issue:`2475`)

- Fix internal error when trying to detect the start of a recursive traceback.
(:issue:`2486`)


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

- Explicitly state for which hooks the calls stop after the first non-None
result. (:issue:`2493`)


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

- Create invoke tasks for updating the vendored packages. (:issue:`2474`)

- Update copyright dates in LICENSE, README.rst and in the documentation.
(:issue:`2499`)

Page 20 of 33

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.