New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pytest to 4.2.0 #86

wants to merge 1 commit into
base: master


None yet
1 participant
Copy link

pyup-bot commented Jan 31, 2019

This PR updates pytest from 4.0.1 to 4.2.0.





- `3094 <>`_: `Class xunit-style <>`__ functions and methods
now obey the scope of *autouse* fixtures.

This fixes a number of surprising issues like ``setup_method`` being called before session-scoped
autouse fixtures (see `517 <>`__ for an example).

- `4627 <>`_: Display a message at the end of the test session when running under Python 2.7 and 3.4 that pytest 5.0 will no longer
support those Python versions.

- `4660 <>`_: The number of *selected* tests now are also displayed when the ``-k`` or ``-m`` flags are used.

- `4688 <>`_: ``pytest_report_teststatus`` hook now can also receive a ``config`` parameter.

- `4691 <>`_: ``pytest_terminal_summary`` hook now can also receive a ``config`` parameter.

Bug Fixes

- `3547 <>`_: ``--junitxml`` can emit XML compatible with Jenkins xUnit.
``junit_family`` INI option accepts ``legacy|xunit1``, which produces old style output, and ``xunit2`` that conforms more strictly to

- `4280 <>`_: Improve quitting from pdb, especially with ``--trace``.

Using ``q[quit]`` after ``pdb.set_trace()`` will quit pytest also.

- `4402 <>`_: Warning summary now groups warnings by message instead of by test id.

This makes the output more compact and better conveys the general idea of how much code is
actually generating warnings, instead of how many tests call that code.

- `4536 <>`_: ``monkeypatch.delattr`` handles class descriptors like ``staticmethod``/``classmethod``.

- `4649 <>`_: Restore marks being considered keywords for keyword expressions.

- `4653 <>`_: ``tmp_path`` fixture and other related ones provides resolved path (a.k.a real path)

- `4667 <>`_: ``pytest_terminal_summary`` uses result from ``pytest_report_teststatus`` hook, rather than hardcoded strings.

- `4669 <>`_: Correctly handle ``unittest.SkipTest`` exception containing non-ascii characters on Python 2.

- `4680 <>`_: Ensure the ``tmpdir`` and the ``tmp_path`` fixtures are the same folder.

- `4681 <>`_: Ensure ``tmp_path`` is always a real path.

Trivial/Internal Changes

- `4643 <>`_: Use ``a.item()`` instead of the deprecated ``np.asscalar(a)`` in ``pytest.approx``.

``np.asscalar`` has been `deprecated <>`__ in ``numpy 1.16.``.

- `4657 <>`_: Copy saferepr from pylib



Bug Fixes

- `2256 <>`_: Show full repr with ``assert a==b`` and ``-vv``.

- `3456 <>`_: Extend Doctest-modules to ignore mock objects.

- `4617 <>`_: Fixed ``pytest.warns`` bug when context manager is reused (e.g. multiple parametrization).

- `4631 <>`_: Don't rewrite assertion when ``__getattr__`` is broken

Improved Documentation

- `3375 <>`_: Document that using ``setup.cfg`` may crash other tools or cause hard to track down problems because it uses a different parser than ``pytest.ini`` or ``tox.ini`` files.

Trivial/Internal Changes

- `4602 <>`_: Uninstall ``hypothesis`` in regen tox env.




- `2169 <>`_: ``pytest.mark.parametrize``: in previous versions, errors raised by id functions were suppressed and changed into warnings. Now the exceptions are propagated, along with a pytest message informing the node, parameter value and index where the exception occurred.

- `3078 <>`_: Remove legacy internal warnings system: ``config.warn``, ``Node.warn``. The ``pytest_logwarning`` now issues a warning when implemented.

See our `docs <>`__ on information on how to update your code.

- `3079 <>`_: Removed support for yield tests - they are fundamentally broken because they don't support fixtures properly since collection and test execution were separated.

See our `docs <>`__ on information on how to update your code.

- `3082 <>`_: Removed support for applying marks directly to values in ``pytest.mark.parametrize``. Use ``pytest.param`` instead.

See our `docs <>`__ on information on how to update your code.

- `3083 <>`_: Removed ``Metafunc.addcall``. This was the predecessor mechanism to ``pytest.mark.parametrize``.

See our `docs <>`__ on information on how to update your code.

- `3085 <>`_: Removed support for passing strings to ``pytest.main``. Now, always pass a list of strings instead.

See our `docs <>`__ on information on how to update your code.

- `3086 <>`_: ``[pytest]`` section in **setup.cfg** files is not longer supported, use ``[tool:pytest]`` instead. ``setup.cfg`` files
are meant for use with ``distutils``, and a section named ``pytest`` has notoriously been a source of conflicts and bugs.

Note that for **pytest.ini** and **tox.ini** files the section remains ``[pytest]``.

- `3616 <>`_: Removed the deprecated compat properties for ``node.Class/Function/Module`` - use ``pytest.Class/Function/Module`` now.

See our `docs <>`__ on information on how to update your code.

- `4421 <>`_: Removed the implementation of the ``pytest_namespace`` hook.

See our `docs <>`__ on information on how to update your code.

- `4489 <>`_: Removed ``request.cached_setup``. This was the predecessor mechanism to modern fixtures.

See our `docs <>`__ on information on how to update your code.

- `4535 <>`_: Removed the deprecated ``PyCollector.makeitem`` method. This method was made public by mistake a long time ago.

- `4543 <>`_: Removed support to define fixtures using the ``pytest_funcarg__`` prefix. Use the ``pytest.fixture`` decorator instead.

See our `docs <>`__ on information on how to update your code.

- `4545 <>`_: Calling fixtures directly is now always an error instead of a warning.

See our `docs <>`__ on information on how to update your code.

- `4546 <>`_: Remove ``Node.get_marker(name)`` the return value was not usable for more than a existence check.

Use ``Node.get_closest_marker(name)`` as a replacement.

- `4547 <>`_: The deprecated ``record_xml_property`` fixture has been removed, use the more generic ``record_property`` instead.

See our `docs <>`__ for more information.

- `4548 <>`_: An error is now raised if the ``pytest_plugins`` variable is defined in a non-top-level ```` file (i.e., not residing in the ``rootdir``).

See our `docs <>`__ for more information.

- `891 <>`_: Remove ``testfunction.markername`` attributes - use ``Node.iter_markers(name=None)`` to iterate them.


- `3050 <>`_: Deprecated the ``pytest.config`` global.

See for rationale.

- `3974 <>`_: Passing the ``message`` parameter of ``pytest.raises`` now issues a ``DeprecationWarning``.

It is a common mistake to think this parameter will match the exception message, while in fact
it only serves to provide a custom message in case the ``pytest.raises`` check fails. To avoid this
mistake and because it is believed to be little used, pytest is deprecating it without providing
an alternative for the moment.

If you have concerns about this, please comment on `issue 3974 <>`__.

- `4435 <>`_: Deprecated ``raises(..., 'code(as_a_string)')`` and ``warns(..., 'code(as_a_string)')``.

See for rationale and examples.


- `3191 <>`_: A warning is now issued when assertions are made for ``None``.

This is a common source of confusion among new users, which write:

.. code-block:: python

   assert mocked_object.assert_called_with(3, 4, 5, key="value")

When they should write:

.. code-block:: python

   mocked_object.assert_called_with(3, 4, 5, key="value")

Because the ``assert_called_with`` method of mock objects already executes an assertion.

This warning will not be issued when ``None`` is explicitly checked. An assertion like:

.. code-block:: python

   assert variable is None

will not issue the warning.

- `3632 <>`_: Richer equality comparison introspection on ``AssertionError`` for objects created using `attrs <>`__ or `dataclasses <>`_ (Python 3.7+, `backported to 3.6 <>`__).

- `4278 <>`_: ``CACHEDIR.TAG`` files are now created inside cache directories.

Those files are part of the `Cache Directory Tagging Standard <>`__, and can
be used by backup or synchronization programs to identify pytest's cache directory as such.

- `4292 <>`_: ``pytest.outcomes.Exit`` is derived from ``SystemExit`` instead of ``KeyboardInterrupt``. This allows us to better handle ``pdb`` exiting.

- `4371 <>`_: Updated the ``--collect-only`` option to display test descriptions when ran using ``--verbose``.

- `4386 <>`_: Restructured ``ExceptionInfo`` object construction and ensure incomplete instances have a ``repr``/``str``.

- `4416 <>`_: pdb: added support for keyword arguments with ``pdb.set_trace``.

It handles ``header`` similar to Python 3.7 does it, and forwards any
other keyword arguments to the ``Pdb`` constructor.

This allows for ``__import__("pdb").set_trace(skip=["foo.*"])``.

- `4483 <>`_: Added ini parameter ``junit_duration_report`` to optionally report test call durations, excluding setup and teardown times.

The JUnit XML specification and the default pytest behavior is to include setup and teardown times in the test duration
report. You can include just the call durations instead (excluding setup and teardown) by adding this to your ``pytest.ini`` file:

.. code-block:: ini

   junit_duration_report = call

- `4532 <>`_: ``-ra`` now will show errors and failures last, instead of as the first items in the summary.

This makes it easier to obtain a list of errors and failures to run tests selectively.

- `4599 <>`_: ``pytest.importorskip`` now supports a ``reason`` parameter, which will be shown when the
requested module cannot be imported.

Bug Fixes

- `3532 <>`_: ``-p`` now accepts its argument without a space between the value, for example ``-pmyplugin``.

- `4327 <>`_: ``approx`` again works with more generic containers, more precisely instances of ``Iterable`` and ``Sized`` instead of more restrictive ``Sequence``.

- `4397 <>`_: Ensure that node ids are printable.

- `4435 <>`_: Fixed ``raises(..., 'code(string)')`` frame filename.

- `4458 <>`_: Display actual test ids in ``--collect-only``.

Improved Documentation

- `4557 <>`_: Markers example documentation page updated to support latest pytest version.

- `4558 <>`_: Update cache documentation example to correctly show cache hit and miss.

- `4580 <>`_: Improved detailed summary report documentation.

Trivial/Internal Changes

- `4447 <>`_: Changed the deprecation type of ``--result-log`` to ``PytestDeprecationWarning``.

It was decided to remove this feature at the next major revision.



Bug Fixes

- `4265 <>`_: Validate arguments from the ``PYTEST_ADDOPTS`` environment variable and the ``addopts`` ini option separately.

- `4435 <>`_: Fix ``raises(..., 'code(string)')`` frame filename.

- `4500 <>`_: When a fixture yields and a log call is made after the test runs, and, if the test is interrupted, capture attributes are ``None``.

- `4538 <>`_: Raise ``TypeError`` for ``with raises(..., match=<non-None falsey value>)``.

Improved Documentation

- `1495 <>`_: Document common doctest fixture directory tree structure pitfalls

@pyup-bot pyup-bot referenced this pull request Jan 31, 2019


Update pytest to 4.1.1 #79


This comment has been minimized.

Copy link
Contributor Author

pyup-bot commented Feb 13, 2019

Closing this in favor of #92

@pyup-bot pyup-bot closed this Feb 13, 2019

@omercnet omercnet deleted the pyup-update-pytest-4.0.1-to-4.2.0 branch Feb 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment