1.. _`changelog`: 2 3========= 4Changelog 5========= 6 7Versions follow `Semantic Versioning <https://semver.org/>`_ (``<major>.<minor>.<patch>``). 8 9Backward incompatible (breaking) changes will only be introduced in major versions 10with advance notice in the **Deprecations** section of releases. 11 12 13.. 14 You should *NOT* be adding new change log entries to this file, this 15 file is managed by towncrier. You *may* edit previous change logs to 16 fix problems like typo corrections or such. 17 To add a new change log entry, please see 18 https://pip.pypa.io/en/latest/development/contributing/#news-entries 19 we named the news folder changelog 20 21 22.. only:: changelog_towncrier_draft 23 24 .. The 'changelog_towncrier_draft' tag is included by our 'tox -e docs', 25 but not on readthedocs. 26 27 .. include:: _changelog_towncrier_draft.rst 28 29.. towncrier release notes start 30 31pytest 6.1.1 (2020-10-03) 32========================= 33 34Bug Fixes 35--------- 36 37- `#7807 <https://github.com/pytest-dev/pytest/issues/7807>`_: Fixed regression in pytest 6.1.0 causing incorrect rootdir to be determined in some non-trivial cases where parent directories have config files as well. 38 39 40- `#7814 <https://github.com/pytest-dev/pytest/issues/7814>`_: Fixed crash in header reporting when :confval:`testpaths` is used and contains absolute paths (regression in 6.1.0). 41 42 43pytest 6.1.0 (2020-09-26) 44========================= 45 46Breaking Changes 47---------------- 48 49- `#5585 <https://github.com/pytest-dev/pytest/issues/5585>`_: As per our policy, the following features which have been deprecated in the 5.X series are now 50 removed: 51 52 * The ``funcargnames`` read-only property of ``FixtureRequest``, ``Metafunc``, and ``Function`` classes. Use ``fixturenames`` attribute. 53 54 * ``@pytest.fixture`` no longer supports positional arguments, pass all arguments by keyword instead. 55 56 * Direct construction of ``Node`` subclasses now raise an error, use ``from_parent`` instead. 57 58 * The default value for ``junit_family`` has changed to ``xunit2``. If you require the old format, add ``junit_family=xunit1`` to your configuration file. 59 60 * The ``TerminalReporter`` no longer has a ``writer`` attribute. Plugin authors may use the public functions of the ``TerminalReporter`` instead of accessing the ``TerminalWriter`` object directly. 61 62 * The ``--result-log`` option has been removed. Users are recommended to use the `pytest-reportlog <https://github.com/pytest-dev/pytest-reportlog>`__ plugin instead. 63 64 65 For more information consult 66 `Deprecations and Removals <https://docs.pytest.org/en/stable/deprecations.html>`__ in the docs. 67 68 69 70Deprecations 71------------ 72 73- `#6981 <https://github.com/pytest-dev/pytest/issues/6981>`_: The ``pytest.collect`` module is deprecated: all its names can be imported from ``pytest`` directly. 74 75 76- `#7097 <https://github.com/pytest-dev/pytest/issues/7097>`_: The ``pytest._fillfuncargs`` function is deprecated. This function was kept 77 for backward compatibility with an older plugin. 78 79 It's functionality is not meant to be used directly, but if you must replace 80 it, use `function._request._fillfixtures()` instead, though note this is not 81 a public API and may break in the future. 82 83 84- `#7210 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` 85 instead. 86 87 The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue 88 if you use this and want a replacement. 89 90 91- `#7255 <https://github.com/pytest-dev/pytest/issues/7255>`_: The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor 92 of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version. 93 94 95- `#7648 <https://github.com/pytest-dev/pytest/issues/7648>`_: The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated; 96 use ``self.session.gethookproxy()`` and ``self.session.isinitpath()`` instead. 97 This should work on all pytest versions. 98 99 100 101Features 102-------- 103 104- `#7667 <https://github.com/pytest-dev/pytest/issues/7667>`_: New ``--durations-min`` command-line flag controls the minimal duration for inclusion in the slowest list of tests shown by ``--durations``. Previously this was hard-coded to ``0.005s``. 105 106 107 108Improvements 109------------ 110 111- `#6681 <https://github.com/pytest-dev/pytest/issues/6681>`_: Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through :confval:`filterwarnings` or ``--pythonwarnings/-W``. 112 113 This also fixes a number of long standing issues: `#2891 <https://github.com/pytest-dev/pytest/issues/2891>`__, `#7620 <https://github.com/pytest-dev/pytest/issues/7620>`__, `#7426 <https://github.com/pytest-dev/pytest/issues/7426>`__. 114 115 116- `#7572 <https://github.com/pytest-dev/pytest/issues/7572>`_: When a plugin listed in ``required_plugins`` is missing or an unknown config key is used with ``--strict-config``, a simple error message is now shown instead of a stacktrace. 117 118 119- `#7685 <https://github.com/pytest-dev/pytest/issues/7685>`_: Added two new attributes :attr:`rootpath <_pytest.config.Config.rootpath>` and :attr:`inipath <_pytest.config.Config.inipath>` to :class:`Config <_pytest.config.Config>`. 120 These attributes are :class:`pathlib.Path` versions of the existing :attr:`rootdir <_pytest.config.Config.rootdir>` and :attr:`inifile <_pytest.config.Config.inifile>` attributes, 121 and should be preferred over them when possible. 122 123 124- `#7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Public classes which are not designed to be inherited from are now marked `@final <https://docs.python.org/3/library/typing.html#typing.final>`_. 125 Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime. 126 Currently the ``final`` designation does not appear in the API Reference but hopefully will in the future. 127 128 129 130Bug Fixes 131--------- 132 133- `#1953 <https://github.com/pytest-dev/pytest/issues/1953>`_: Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value. 134 135 .. code-block:: python 136 137 # conftest.py 138 import pytest 139 140 141 @pytest.fixture(params=[1, 2]) 142 def foo(request): 143 return request.param 144 145 146 # test_foo.py 147 import pytest 148 149 150 @pytest.fixture 151 def foo(foo): 152 return foo * 2 153 154 155- `#4984 <https://github.com/pytest-dev/pytest/issues/4984>`_: Fixed an internal error crash with ``IndexError: list index out of range`` when 156 collecting a module which starts with a decorated function, the decorator 157 raises, and assertion rewriting is enabled. 158 159 160- `#7591 <https://github.com/pytest-dev/pytest/issues/7591>`_: pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from :ref:`File <non-python tests>`. 161 162 163- `#7628 <https://github.com/pytest-dev/pytest/issues/7628>`_: Fixed test collection when a full path without a drive letter was passed to pytest on Windows (for example ``\projects\tests\test.py`` instead of ``c:\projects\tests\pytest.py``). 164 165 166- `#7638 <https://github.com/pytest-dev/pytest/issues/7638>`_: Fix handling of command-line options that appear as paths but trigger an OS-level syntax error on Windows, such as the options used internally by ``pytest-xdist``. 167 168 169- `#7742 <https://github.com/pytest-dev/pytest/issues/7742>`_: Fixed INTERNALERROR when accessing locals / globals with faulty ``exec``. 170 171 172 173Improved Documentation 174---------------------- 175 176- `#1477 <https://github.com/pytest-dev/pytest/issues/1477>`_: Removed faq.rst and its reference in contents.rst. 177 178 179 180Trivial/Internal Changes 181------------------------ 182 183- `#7536 <https://github.com/pytest-dev/pytest/issues/7536>`_: The internal ``junitxml`` plugin has rewritten to use ``xml.etree.ElementTree``. 184 The order of attributes in XML elements might differ. Some unneeded escaping is 185 no longer performed. 186 187 188- `#7587 <https://github.com/pytest-dev/pytest/issues/7587>`_: The dependency on the ``more-itertools`` package has been removed. 189 190 191- `#7631 <https://github.com/pytest-dev/pytest/issues/7631>`_: The result type of :meth:`capfd.readouterr() <_pytest.capture.CaptureFixture.readouterr>` (and similar) is no longer a namedtuple, 192 but should behave like one in all respects. This was done for technical reasons. 193 194 195- `#7671 <https://github.com/pytest-dev/pytest/issues/7671>`_: When collecting tests, pytest finds test classes and functions by examining the 196 attributes of python objects (modules, classes and instances). To speed up this 197 process, pytest now ignores builtin attributes (like ``__class__``, 198 ``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and 199 :confval:`python_functions` configuration options and without passing them to plugins 200 using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook. 201 202 203pytest 6.0.2 (2020-09-04) 204========================= 205 206Bug Fixes 207--------- 208 209- `#7148 <https://github.com/pytest-dev/pytest/issues/7148>`_: Fixed ``--log-cli`` potentially causing unrelated ``print`` output to be swallowed. 210 211 212- `#7672 <https://github.com/pytest-dev/pytest/issues/7672>`_: Fixed log-capturing level restored incorrectly if ``caplog.set_level`` is called more than once. 213 214 215- `#7686 <https://github.com/pytest-dev/pytest/issues/7686>`_: Fixed `NotSetType.token` being used as the parameter ID when the parametrization list is empty. 216 Regressed in pytest 6.0.0. 217 218 219- `#7707 <https://github.com/pytest-dev/pytest/issues/7707>`_: Fix internal error when handling some exceptions that contain multiple lines or the style uses multiple lines (``--tb=line`` for example). 220 221 222pytest 6.0.1 (2020-07-30) 223========================= 224 225Bug Fixes 226--------- 227 228- `#7394 <https://github.com/pytest-dev/pytest/issues/7394>`_: Passing an empty ``help`` value to ``Parser.add_option`` is now accepted instead of crashing when running ``pytest --help``. 229 Passing ``None`` raises a more informative ``TypeError``. 230 231 232- `#7558 <https://github.com/pytest-dev/pytest/issues/7558>`_: Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks: 233 ``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``. 234 235 236- `#7559 <https://github.com/pytest-dev/pytest/issues/7559>`_: Fix regression in plugins using ``TestReport.longreprtext`` (such as ``pytest-html``) when ``TestReport.longrepr`` is not a string. 237 238 239- `#7569 <https://github.com/pytest-dev/pytest/issues/7569>`_: Fix logging capture handler's level not reset on teardown after a call to ``caplog.set_level()``. 240 241 242pytest 6.0.0 (2020-07-28) 243========================= 244 245(**Please see the full set of changes for this release also in the 6.0.0rc1 notes below**) 246 247Breaking Changes 248---------------- 249 250- `#5584 <https://github.com/pytest-dev/pytest/issues/5584>`_: **PytestDeprecationWarning are now errors by default.** 251 252 Following our plan to remove deprecated features with as little disruption as 253 possible, all warnings of type ``PytestDeprecationWarning`` now generate errors 254 instead of warning messages. 255 256 **The affected features will be effectively removed in pytest 6.1**, so please consult the 257 `Deprecations and Removals <https://docs.pytest.org/en/latest/deprecations.html>`__ 258 section in the docs for directions on how to update existing code. 259 260 In the pytest ``6.0.X`` series, it is possible to change the errors back into warnings as a 261 stopgap measure by adding this to your ``pytest.ini`` file: 262 263 .. code-block:: ini 264 265 [pytest] 266 filterwarnings = 267 ignore::pytest.PytestDeprecationWarning 268 269 But this will stop working when pytest ``6.1`` is released. 270 271 **If you have concerns** about the removal of a specific feature, please add a 272 comment to `#5584 <https://github.com/pytest-dev/pytest/issues/5584>`__. 273 274 275- `#7472 <https://github.com/pytest-dev/pytest/issues/7472>`_: The ``exec_()`` and ``is_true()`` methods of ``_pytest._code.Frame`` have been removed. 276 277 278 279Features 280-------- 281 282- `#7464 <https://github.com/pytest-dev/pytest/issues/7464>`_: Added support for :envvar:`NO_COLOR` and :envvar:`FORCE_COLOR` environment variables to control colored output. 283 284 285 286Improvements 287------------ 288 289- `#7467 <https://github.com/pytest-dev/pytest/issues/7467>`_: ``--log-file`` CLI option and ``log_file`` ini marker now create subdirectories if needed. 290 291 292- `#7489 <https://github.com/pytest-dev/pytest/issues/7489>`_: The :func:`pytest.raises` function has a clearer error message when ``match`` equals the obtained string but is not a regex match. In this case it is suggested to escape the regex. 293 294 295 296Bug Fixes 297--------- 298 299- `#7392 <https://github.com/pytest-dev/pytest/issues/7392>`_: Fix the reported location of tests skipped with ``@pytest.mark.skip`` when ``--runxfail`` is used. 300 301 302- `#7491 <https://github.com/pytest-dev/pytest/issues/7491>`_: :fixture:`tmpdir` and :fixture:`tmp_path` no longer raise an error if the lock to check for 303 stale temporary directories is not accessible. 304 305 306- `#7517 <https://github.com/pytest-dev/pytest/issues/7517>`_: Preserve line endings when captured via ``capfd``. 307 308 309- `#7534 <https://github.com/pytest-dev/pytest/issues/7534>`_: Restored the previous formatting of ``TracebackEntry.__str__`` which was changed by accident. 310 311 312 313Improved Documentation 314---------------------- 315 316- `#7422 <https://github.com/pytest-dev/pytest/issues/7422>`_: Clarified when the ``usefixtures`` mark can apply fixtures to test. 317 318 319- `#7441 <https://github.com/pytest-dev/pytest/issues/7441>`_: Add a note about ``-q`` option used in getting started guide. 320 321 322 323Trivial/Internal Changes 324------------------------ 325 326- `#7389 <https://github.com/pytest-dev/pytest/issues/7389>`_: Fixture scope ``package`` is no longer considered experimental. 327 328 329pytest 6.0.0rc1 (2020-07-08) 330============================ 331 332Breaking Changes 333---------------- 334 335- `#1316 <https://github.com/pytest-dev/pytest/issues/1316>`_: ``TestReport.longrepr`` is now always an instance of ``ReprExceptionInfo``. Previously it was a ``str`` when a test failed with ``pytest.fail(..., pytrace=False)``. 336 337 338- `#5965 <https://github.com/pytest-dev/pytest/issues/5965>`_: symlinks are no longer resolved during collection and matching `conftest.py` files with test file paths. 339 340 Resolving symlinks for the current directory and during collection was introduced as a bugfix in 3.9.0, but it actually is a new feature which had unfortunate consequences in Windows and surprising results in other platforms. 341 342 The team decided to step back on resolving symlinks at all, planning to review this in the future with a more solid solution (see discussion in 343 `#6523 <https://github.com/pytest-dev/pytest/pull/6523>`__ for details). 344 345 This might break test suites which made use of this feature; the fix is to create a symlink 346 for the entire test tree, and not only to partial files/tress as it was possible previously. 347 348 349- `#6505 <https://github.com/pytest-dev/pytest/issues/6505>`_: ``Testdir.run().parseoutcomes()`` now always returns the parsed nouns in plural form. 350 351 Originally ``parseoutcomes()`` would always returns the nouns in plural form, but a change 352 meant to improve the terminal summary by using singular form single items (``1 warning`` or ``1 error``) 353 caused an unintended regression by changing the keys returned by ``parseoutcomes()``. 354 355 Now the API guarantees to always return the plural form, so calls like this: 356 357 .. code-block:: python 358 359 result = testdir.runpytest() 360 result.assert_outcomes(error=1) 361 362 Need to be changed to: 363 364 365 .. code-block:: python 366 367 result = testdir.runpytest() 368 result.assert_outcomes(errors=1) 369 370 371- `#6903 <https://github.com/pytest-dev/pytest/issues/6903>`_: The ``os.dup()`` function is now assumed to exist. We are not aware of any 372 supported Python 3 implementations which do not provide it. 373 374 375- `#7040 <https://github.com/pytest-dev/pytest/issues/7040>`_: ``-k`` no longer matches against the names of the directories outside the test session root. 376 377 Also, ``pytest.Package.name`` is now just the name of the directory containing the package's 378 ``__init__.py`` file, instead of the full path. This is consistent with how the other nodes 379 are named, and also one of the reasons why ``-k`` would match against any directory containing 380 the test suite. 381 382 383- `#7122 <https://github.com/pytest-dev/pytest/issues/7122>`_: Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's :func:`eval`. 384 The format supports ``or``, ``and``, ``not``, parenthesis and general identifiers to match against. 385 Python constants, keywords or other operators are no longer evaluated differently. 386 387 388- `#7135 <https://github.com/pytest-dev/pytest/issues/7135>`_: Pytest now uses its own ``TerminalWriter`` class instead of using the one from the ``py`` library. 389 Plugins generally access this class through ``TerminalReporter.writer``, ``TerminalReporter.write()`` 390 (and similar methods), or ``_pytest.config.create_terminal_writer()``. 391 392 The following breaking changes were made: 393 394 - Output (``write()`` method and others) no longer flush implicitly; the flushing behavior 395 of the underlying file is respected. To flush explicitly (for example, if you 396 want output to be shown before an end-of-line is printed), use ``write(flush=True)`` or 397 ``terminal_writer.flush()``. 398 - Explicit Windows console support was removed, delegated to the colorama library. 399 - Support for writing ``bytes`` was removed. 400 - The ``reline`` method and ``chars_on_current_line`` property were removed. 401 - The ``stringio`` and ``encoding`` arguments was removed. 402 - Support for passing a callable instead of a file was removed. 403 404 405- `#7224 <https://github.com/pytest-dev/pytest/issues/7224>`_: The `item.catch_log_handler` and `item.catch_log_handlers` attributes, set by the 406 logging plugin and never meant to be public, are no longer available. 407 408 The deprecated ``--no-print-logs`` option and ``log_print`` ini option are removed. Use ``--show-capture`` instead. 409 410 411- `#7226 <https://github.com/pytest-dev/pytest/issues/7226>`_: Removed the unused ``args`` parameter from ``pytest.Function.__init__``. 412 413 414- `#7418 <https://github.com/pytest-dev/pytest/issues/7418>`_: Removed the `pytest_doctest_prepare_content` hook specification. This hook 415 hasn't been triggered by pytest for at least 10 years. 416 417 418- `#7438 <https://github.com/pytest-dev/pytest/issues/7438>`_: Some changes were made to the internal ``_pytest._code.source``, listed here 419 for the benefit of plugin authors who may be using it: 420 421 - The ``deindent`` argument to ``Source()`` has been removed, now it is always true. 422 - Support for zero or multiple arguments to ``Source()`` has been removed. 423 - Support for comparing ``Source`` with an ``str`` has been removed. 424 - The methods ``Source.isparseable()`` and ``Source.putaround()`` have been removed. 425 - The method ``Source.compile()`` and function ``_pytest._code.compile()`` have 426 been removed; use plain ``compile()`` instead. 427 - The function ``_pytest._code.source.getsource()`` has been removed; use 428 ``Source()`` directly instead. 429 430 431 432Deprecations 433------------ 434 435- `#7210 <https://github.com/pytest-dev/pytest/issues/7210>`_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` 436 instead. 437 438 The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue 439 if you use this and want a replacement. 440 441- `#4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: ``pytest_warning_captured`` is deprecated in favor of the ``pytest_warning_recorded`` hook. 442 443 444Features 445-------- 446 447- `#1556 <https://github.com/pytest-dev/pytest/issues/1556>`_: pytest now supports ``pyproject.toml`` files for configuration. 448 449 The configuration options is similar to the one available in other formats, but must be defined 450 in a ``[tool.pytest.ini_options]`` table to be picked up by pytest: 451 452 .. code-block:: toml 453 454 # pyproject.toml 455 [tool.pytest.ini_options] 456 minversion = "6.0" 457 addopts = "-ra -q" 458 testpaths = [ 459 "tests", 460 "integration", 461 ] 462 463 More information can be found `in the docs <https://docs.pytest.org/en/stable/customize.html#configuration-file-formats>`__. 464 465 466- `#3342 <https://github.com/pytest-dev/pytest/issues/3342>`_: pytest now includes inline type annotations and exposes them to user programs. 467 Most of the user-facing API is covered, as well as internal code. 468 469 If you are running a type checker such as mypy on your tests, you may start 470 noticing type errors indicating incorrect usage. If you run into an error that 471 you believe to be incorrect, please let us know in an issue. 472 473 The types were developed against mypy version 0.780. Versions before 0.750 474 are known not to work. We recommend using the latest version. Other type 475 checkers may work as well, but they are not officially verified to work by 476 pytest yet. 477 478 479- `#4049 <https://github.com/pytest-dev/pytest/issues/4049>`_: Introduced a new hook named `pytest_warning_recorded` to convey information about warnings captured by the internal `pytest` warnings plugin. 480 481 This hook is meant to replace `pytest_warning_captured`, which is deprecated and will be removed in a future release. 482 483 484- `#6471 <https://github.com/pytest-dev/pytest/issues/6471>`_: New command-line flags: 485 486 * `--no-header`: disables the initial header, including platform, version, and plugins. 487 * `--no-summary`: disables the final test summary, including warnings. 488 489 490- `#6856 <https://github.com/pytest-dev/pytest/issues/6856>`_: A warning is now shown when an unknown key is read from a config INI file. 491 492 The `--strict-config` flag has been added to treat these warnings as errors. 493 494 495- `#6906 <https://github.com/pytest-dev/pytest/issues/6906>`_: Added `--code-highlight` command line option to enable/disable code highlighting in terminal output. 496 497 498- `#7245 <https://github.com/pytest-dev/pytest/issues/7245>`_: New ``--import-mode=importlib`` option that uses `importlib <https://docs.python.org/3/library/importlib.html>`__ to import test modules. 499 500 Traditionally pytest used ``__import__`` while changing ``sys.path`` to import test modules (which 501 also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules 502 that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). 503 504 ``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't 505 require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks 506 of the previous mode. 507 508 We intend to make ``--import-mode=importlib`` the default in future versions, so users are encouraged 509 to try the new mode and provide feedback (both positive or negative) in issue `#7245 <https://github.com/pytest-dev/pytest/issues/7245>`__. 510 511 You can read more about this option in `the documentation <https://docs.pytest.org/en/latest/pythonpath.html#import-modes>`__. 512 513 514- `#7305 <https://github.com/pytest-dev/pytest/issues/7305>`_: New ``required_plugins`` configuration option allows the user to specify a list of plugins, including version information, that are required for pytest to run. An error is raised if any required plugins are not found when running pytest. 515 516 517Improvements 518------------ 519 520- `#4375 <https://github.com/pytest-dev/pytest/issues/4375>`_: The ``pytest`` command now suppresses the ``BrokenPipeError`` error message that 521 is printed to stderr when the output of ``pytest`` is piped and and the pipe is 522 closed by the piped-to program (common examples are ``less`` and ``head``). 523 524 525- `#4391 <https://github.com/pytest-dev/pytest/issues/4391>`_: Improved precision of test durations measurement. ``CallInfo`` items now have a new ``<CallInfo>.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``<TestReport>.duration`` attribute, which is more accurate than the previous ``<CallInfo>.stop - <CallInfo>.start`` (as these are based on ``time.time()``). 526 527 528- `#4675 <https://github.com/pytest-dev/pytest/issues/4675>`_: Rich comparison for dataclasses and `attrs`-classes is now recursive. 529 530 531- `#6285 <https://github.com/pytest-dev/pytest/issues/6285>`_: Exposed the `pytest.FixtureLookupError` exception which is raised by `request.getfixturevalue()` 532 (where `request` is a `FixtureRequest` fixture) when a fixture with the given name cannot be returned. 533 534 535- `#6433 <https://github.com/pytest-dev/pytest/issues/6433>`_: If an error is encountered while formatting the message in a logging call, for 536 example ``logging.warning("oh no!: %s: %s", "first")`` (a second argument is 537 missing), pytest now propagates the error, likely causing the test to fail. 538 539 Previously, such a mistake would cause an error to be printed to stderr, which 540 is not displayed by default for passing tests. This change makes the mistake 541 visible during testing. 542 543 You may supress this behavior temporarily or permanently by setting 544 ``logging.raiseExceptions = False``. 545 546 547- `#6817 <https://github.com/pytest-dev/pytest/issues/6817>`_: Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control 548 of the help displayed to users. 549 550 551- `#6940 <https://github.com/pytest-dev/pytest/issues/6940>`_: When using the ``--duration`` option, the terminal message output is now more precise about the number and duration of hidden items. 552 553 554- `#6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``. 555 556 557- `#7091 <https://github.com/pytest-dev/pytest/issues/7091>`_: When ``fd`` capturing is used, through ``--capture=fd`` or the ``capfd`` and 558 ``capfdbinary`` fixtures, and the file descriptor (0, 1, 2) cannot be 559 duplicated, FD capturing is still performed. Previously, direct writes to the 560 file descriptors would fail or be lost in this case. 561 562 563- `#7119 <https://github.com/pytest-dev/pytest/issues/7119>`_: Exit with an error if the ``--basetemp`` argument is empty, is the current working directory or is one of the parent directories. 564 This is done to protect against accidental data loss, as any directory passed to this argument is cleared. 565 566 567- `#7128 <https://github.com/pytest-dev/pytest/issues/7128>`_: `pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins. This is more consistent with how other tools show `--version`. 568 569 570- `#7133 <https://github.com/pytest-dev/pytest/issues/7133>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` will now override any :confval:`log_level` set via the CLI or configuration file. 571 572 573- `#7159 <https://github.com/pytest-dev/pytest/issues/7159>`_: :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` and :meth:`caplog.at_level() <_pytest.logging.LogCaptureFixture.at_level>` no longer affect 574 the level of logs that are shown in the *Captured log report* report section. 575 576 577- `#7348 <https://github.com/pytest-dev/pytest/issues/7348>`_: Improve recursive diff report for comparison asserts on dataclasses / attrs. 578 579 580- `#7385 <https://github.com/pytest-dev/pytest/issues/7385>`_: ``--junitxml`` now includes the exception cause in the ``message`` XML attribute for failures during setup and teardown. 581 582 Previously: 583 584 .. code-block:: xml 585 586 <error message="test setup failure"> 587 588 Now: 589 590 .. code-block:: xml 591 592 <error message="failed on setup with "ValueError: Some error during setup""> 593 594 595 596Bug Fixes 597--------- 598 599- `#1120 <https://github.com/pytest-dev/pytest/issues/1120>`_: Fix issue where directories from :fixture:`tmpdir` are not removed properly when multiple instances of pytest are running in parallel. 600 601 602- `#4583 <https://github.com/pytest-dev/pytest/issues/4583>`_: Prevent crashing and provide a user-friendly error when a marker expression (`-m`) invoking of :func:`eval` raises any exception. 603 604 605- `#4677 <https://github.com/pytest-dev/pytest/issues/4677>`_: The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. 606 607 608- `#5456 <https://github.com/pytest-dev/pytest/issues/5456>`_: Fix a possible race condition when trying to remove lock files used to control access to folders 609 created by :fixture:`tmp_path` and :fixture:`tmpdir`. 610 611 612- `#6240 <https://github.com/pytest-dev/pytest/issues/6240>`_: Fixes an issue where logging during collection step caused duplication of log 613 messages to stderr. 614 615 616- `#6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has 617 changed since the start of the session. 618 619 620- `#6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside :fixture:`tmpdir`. 621 622 623- `#6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using :fixture:`capsysbinary`. 624 625 626- `#6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``@pytest.mark.parametrize`` to be explicitly defined in the function signature. 627 628 The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. 629 630 631- `#6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. 632 633 634- `#6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. 635 636 637- `#6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix `TerminalRepr` instances to be hashable again. 638 639 640- `#6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with :meth:`unittest.TestCase.addCleanup` were not being called on test failures. 641 642 643- `#6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. 644 645 646- `#6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing `ConftestImportFailure` traceback to stdout. 647 648 649- `#6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Fix regressions with `--lf` filtering too much since pytest 5.4. 650 651 652- `#6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" `#6767 <https://github.com/pytest-dev/pytest/issues/6767>`_ as it breaks pytest-xdist. 653 654 655- `#7061 <https://github.com/pytest-dev/pytest/issues/7061>`_: When a yielding fixture fails to yield a value, report a test setup error instead of crashing. 656 657 658- `#7076 <https://github.com/pytest-dev/pytest/issues/7076>`_: The path of file skipped by ``@pytest.mark.skip`` in the SKIPPED report is now relative to invocation directory. Previously it was relative to root directory. 659 660 661- `#7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. 662 663 664- `#7126 <https://github.com/pytest-dev/pytest/issues/7126>`_: ``--setup-show`` now doesn't raise an error when a bytes value is used as a ``parametrize`` 665 parameter when Python is called with the ``-bb`` flag. 666 667 668- `#7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix :meth:`pytest.File.from_parent` so it forwards extra keyword arguments to the constructor. 669 670 671- `#7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. 672 673 674- `#7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. 675 676 677- `#7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. 678 679 680- `#7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call :meth:`unittest.TestCase.tearDown` for skipped tests. 681 682 683- `#7253 <https://github.com/pytest-dev/pytest/issues/7253>`_: When using ``pytest.fixture`` on a function directly, as in ``pytest.fixture(func)``, 684 if the ``autouse`` or ``params`` arguments are also passed, the function is no longer 685 ignored, but is marked as a fixture. 686 687 688- `#7360 <https://github.com/pytest-dev/pytest/issues/7360>`_: Fix possibly incorrect evaluation of string expressions passed to ``pytest.mark.skipif`` and ``pytest.mark.xfail``, 689 in rare circumstances where the exact same string is used but refers to different global values. 690 691 692- `#7383 <https://github.com/pytest-dev/pytest/issues/7383>`_: Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception. 693 694 695 696Improved Documentation 697---------------------- 698 699- `#7202 <https://github.com/pytest-dev/pytest/issues/7202>`_: The development guide now links to the contributing section of the docs and `RELEASING.rst` on GitHub. 700 701 702- `#7233 <https://github.com/pytest-dev/pytest/issues/7233>`_: Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one. 703 704 705- `#7345 <https://github.com/pytest-dev/pytest/issues/7345>`_: Explain indirect parametrization and markers for fixtures. 706 707 708 709Trivial/Internal Changes 710------------------------ 711 712- `#7035 <https://github.com/pytest-dev/pytest/issues/7035>`_: The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not 713 provided explicitly, and is always set. 714 715 716- `#7264 <https://github.com/pytest-dev/pytest/issues/7264>`_: The dependency on the ``wcwidth`` package has been removed. 717 718 719- `#7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__. 720 721 722- `#7295 <https://github.com/pytest-dev/pytest/issues/7295>`_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``. 723 724 725- `#7356 <https://github.com/pytest-dev/pytest/issues/7356>`_: Remove last internal uses of deprecated *slave* term from old ``pytest-xdist``. 726 727 728- `#7357 <https://github.com/pytest-dev/pytest/issues/7357>`_: ``py``>=1.8.2 is now required. 729 730 731pytest 5.4.3 (2020-06-02) 732========================= 733 734Bug Fixes 735--------- 736 737- `#6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has 738 changed since the start of the session. 739 740 741- `#6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside tmpdir. 742 743 744- `#6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing ConftestImportFailure traceback to stdout. 745 746 747- `#7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. 748 749 750- `#7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase`` 751 subclasses for skipped tests. 752 753 754pytest 5.4.2 (2020-05-08) 755========================= 756 757Bug Fixes 758--------- 759 760- `#6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using the :fixture:`capsysbinary fixture <capsysbinary>`. 761 762 763- `#6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. 764 765 766- `#6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix TerminalRepr instances to be hashable again. 767 768 769- `#6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures. 770 771 772- `#6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. 773 774 775- `#6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist. 776 777 778- `#7110 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. 779 780 781- `#7143 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix ``File.from_constructor`` so it forwards extra keyword arguments to the constructor. 782 783 784- `#7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. 785 786 787- `#7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale. 788 789 790pytest 5.4.1 (2020-03-13) 791========================= 792 793Bug Fixes 794--------- 795 796- `#6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/6330>`_, which required all arguments to ``@pytest.mark.parametrize`` to be explicitly defined in the function signature. 797 798 The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. 799 800 801- `#6910 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. 802 803 804pytest 5.4.0 (2020-03-12) 805========================= 806 807Breaking Changes 808---------------- 809 810- `#6316 <https://github.com/pytest-dev/pytest/issues/6316>`_: Matching of ``-k EXPRESSION`` to test names is now case-insensitive. 811 812 813- `#6443 <https://github.com/pytest-dev/pytest/issues/6443>`_: Plugins specified with ``-p`` are now loaded after internal plugins, which results in their hooks being called *before* the internal ones. 814 815 This makes the ``-p`` behavior consistent with ``PYTEST_PLUGINS``. 816 817 818- `#6637 <https://github.com/pytest-dev/pytest/issues/6637>`_: Removed the long-deprecated ``pytest_itemstart`` hook. 819 820 This hook has been marked as deprecated and not been even called by pytest for over 10 years now. 821 822 823- `#6673 <https://github.com/pytest-dev/pytest/issues/6673>`_: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result. 824 825 826- `#6737 <https://github.com/pytest-dev/pytest/issues/6737>`_: The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when 827 the result is unavailable, instead of being deleted. 828 829 If your plugin performs checks like ``hasattr(fixturedef, 'cached_result')``, 830 for example in a ``pytest_fixture_post_finalizer`` hook implementation, replace 831 it with ``fixturedef.cached_result is not None``. If you ``del`` the attribute, 832 set it to ``None`` instead. 833 834 835 836Deprecations 837------------ 838 839- `#3238 <https://github.com/pytest-dev/pytest/issues/3238>`_: Option ``--no-print-logs`` is deprecated and meant to be removed in a future release. If you use ``--no-print-logs``, please try out ``--show-capture`` and 840 provide feedback. 841 842 ``--show-capture`` command-line option was added in ``pytest 3.5.0`` and allows to specify how to 843 display captured output when tests fail: ``no``, ``stdout``, ``stderr``, ``log`` or ``all`` (the default). 844 845 846- `#571 <https://github.com/pytest-dev/pytest/issues/571>`_: Deprecate the unused/broken `pytest_collect_directory` hook. 847 It was misaligned since the removal of the ``Directory`` collector in 2010 848 and incorrect/unusable as soon as collection was split from test execution. 849 850 851- `#5975 <https://github.com/pytest-dev/pytest/issues/5975>`_: Deprecate using direct constructors for ``Nodes``. 852 853 Instead they are now constructed via ``Node.from_parent``. 854 855 This transitional mechanism enables us to untangle the very intensely 856 entangled ``Node`` relationships by enforcing more controlled creation/configuration patterns. 857 858 As part of this change, session/config are already disallowed parameters and as we work on the details we might need disallow a few more as well. 859 860 Subclasses are expected to use `super().from_parent` if they intend to expand the creation of `Nodes`. 861 862 863- `#6779 <https://github.com/pytest-dev/pytest/issues/6779>`_: The ``TerminalReporter.writer`` attribute has been deprecated and should no longer be used. This 864 was inadvertently exposed as part of the public API of that plugin and ties it too much 865 with ``py.io.TerminalWriter``. 866 867 868 869Features 870-------- 871 872- `#4597 <https://github.com/pytest-dev/pytest/issues/4597>`_: New :ref:`--capture=tee-sys <capture-method>` option to allow both live printing and capturing of test output. 873 874 875- `#5712 <https://github.com/pytest-dev/pytest/issues/5712>`_: Now all arguments to ``@pytest.mark.parametrize`` need to be explicitly declared in the function signature or via ``indirect``. 876 Previously it was possible to omit an argument if a fixture with the same name existed, which was just an accident of implementation and was not meant to be a part of the API. 877 878 879- `#6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: Changed default for `-r` to `fE`, which displays failures and errors in the :ref:`short test summary <pytest.detailed_failed_tests_usage>`. `-rN` can be used to disable it (the old behavior). 880 881 882- `#6469 <https://github.com/pytest-dev/pytest/issues/6469>`_: New options have been added to the :confval:`junit_logging` option: ``log``, ``out-err``, and ``all``. 883 884 885- `#6834 <https://github.com/pytest-dev/pytest/issues/6834>`_: Excess warning summaries are now collapsed per file to ensure readable display of warning summaries. 886 887 888 889Improvements 890------------ 891 892- `#1857 <https://github.com/pytest-dev/pytest/issues/1857>`_: ``pytest.mark.parametrize`` accepts integers for ``ids`` again, converting it to strings. 893 894 895- `#449 <https://github.com/pytest-dev/pytest/issues/449>`_: Use "yellow" main color with any XPASSED tests. 896 897 898- `#4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". 899 900 The warning proved to be less useful than initially expected and had quite a 901 few false positive cases. 902 903 904- `#5686 <https://github.com/pytest-dev/pytest/issues/5686>`_: ``tmpdir_factory.mktemp`` now fails when given absolute and non-normalized paths. 905 906 907- `#5984 <https://github.com/pytest-dev/pytest/issues/5984>`_: The ``pytest_warning_captured`` hook now receives a ``location`` parameter with the code location that generated the warning. 908 909 910- `#6213 <https://github.com/pytest-dev/pytest/issues/6213>`_: pytester: the ``testdir`` fixture respects environment settings from the ``monkeypatch`` fixture for inner runs. 911 912 913- `#6247 <https://github.com/pytest-dev/pytest/issues/6247>`_: ``--fulltrace`` is honored with collection errors. 914 915 916- `#6384 <https://github.com/pytest-dev/pytest/issues/6384>`_: Make `--showlocals` work also with `--tb=short`. 917 918 919- `#6653 <https://github.com/pytest-dev/pytest/issues/6653>`_: Add support for matching lines consecutively with :attr:`LineMatcher <_pytest.pytester.LineMatcher>`'s :func:`~_pytest.pytester.LineMatcher.fnmatch_lines` and :func:`~_pytest.pytester.LineMatcher.re_match_lines`. 920 921 922- `#6658 <https://github.com/pytest-dev/pytest/issues/6658>`_: Code is now highlighted in tracebacks when ``pygments`` is installed. 923 924 Users are encouraged to install ``pygments`` into their environment and provide feedback, because 925 the plan is to make ``pygments`` a regular dependency in the future. 926 927 928- `#6795 <https://github.com/pytest-dev/pytest/issues/6795>`_: Import usage error message with invalid `-o` option. 929 930 931- `#759 <https://github.com/pytest-dev/pytest/issues/759>`_: ``pytest.mark.parametrize`` supports iterators and generators for ``ids``. 932 933 934 935Bug Fixes 936--------- 937 938- `#310 <https://github.com/pytest-dev/pytest/issues/310>`_: Add support for calling `pytest.xfail()` and `pytest.importorskip()` with doctests. 939 940 941- `#3823 <https://github.com/pytest-dev/pytest/issues/3823>`_: ``--trace`` now works with unittests. 942 943 944- `#4445 <https://github.com/pytest-dev/pytest/issues/4445>`_: Fixed some warning reports produced by pytest to point to the correct location of the warning in the user's code. 945 946 947- `#5301 <https://github.com/pytest-dev/pytest/issues/5301>`_: Fix ``--last-failed`` to collect new tests from files with known failures. 948 949 950- `#5928 <https://github.com/pytest-dev/pytest/issues/5928>`_: Report ``PytestUnknownMarkWarning`` at the level of the user's code, not ``pytest``'s. 951 952 953- `#5991 <https://github.com/pytest-dev/pytest/issues/5991>`_: Fix interaction with ``--pdb`` and unittests: do not use unittest's ``TestCase.debug()``. 954 955 956- `#6334 <https://github.com/pytest-dev/pytest/issues/6334>`_: Fix summary entries appearing twice when ``f/F`` and ``s/S`` report chars were used at the same time in the ``-r`` command-line option (for example ``-rFf``). 957 958 The upper case variants were never documented and the preferred form should be the lower case. 959 960 961- `#6409 <https://github.com/pytest-dev/pytest/issues/6409>`_: Fallback to green (instead of yellow) for non-last items without previous passes with colored terminal progress indicator. 962 963 964- `#6454 <https://github.com/pytest-dev/pytest/issues/6454>`_: `--disable-warnings` is honored with `-ra` and `-rA`. 965 966 967- `#6497 <https://github.com/pytest-dev/pytest/issues/6497>`_: Fix bug in the comparison of request key with cached key in fixture. 968 969 A construct ``if key == cached_key:`` can fail either because ``==`` is explicitly disallowed, or for, e.g., NumPy arrays, where the result of ``a == b`` cannot generally be converted to `bool`. 970 The implemented fix replaces `==` with ``is``. 971 972 973- `#6557 <https://github.com/pytest-dev/pytest/issues/6557>`_: Make capture output streams ``.write()`` method return the same return value from original streams. 974 975 976- `#6566 <https://github.com/pytest-dev/pytest/issues/6566>`_: Fix ``EncodedFile.writelines`` to call the underlying buffer's ``writelines`` method. 977 978 979- `#6575 <https://github.com/pytest-dev/pytest/issues/6575>`_: Fix internal crash when ``faulthandler`` starts initialized 980 (for example with ``PYTHONFAULTHANDLER=1`` environment variable set) and ``faulthandler_timeout`` defined 981 in the configuration file. 982 983 984- `#6597 <https://github.com/pytest-dev/pytest/issues/6597>`_: Fix node ids which contain a parametrized empty-string variable. 985 986 987- `#6646 <https://github.com/pytest-dev/pytest/issues/6646>`_: Assertion rewriting hooks are (re)stored for the current item, which fixes them being still used after e.g. pytester's :func:`testdir.runpytest <_pytest.pytester.Testdir.runpytest>` etc. 988 989 990- `#6660 <https://github.com/pytest-dev/pytest/issues/6660>`_: :py:func:`pytest.exit` is handled when emitted from the :func:`pytest_sessionfinish <_pytest.hookspec.pytest_sessionfinish>` hook. This includes quitting from a debugger. 991 992 993- `#6752 <https://github.com/pytest-dev/pytest/issues/6752>`_: When :py:func:`pytest.raises` is used as a function (as opposed to a context manager), 994 a `match` keyword argument is now passed through to the tested function. Previously 995 it was swallowed and ignored (regression in pytest 5.1.0). 996 997 998- `#6801 <https://github.com/pytest-dev/pytest/issues/6801>`_: Do not display empty lines inbetween traceback for unexpected exceptions with doctests. 999 1000 1001- `#6802 <https://github.com/pytest-dev/pytest/issues/6802>`_: The :fixture:`testdir fixture <testdir>` works within doctests now. 1002 1003 1004 1005Improved Documentation 1006---------------------- 1007 1008- `#6696 <https://github.com/pytest-dev/pytest/issues/6696>`_: Add list of fixtures to start of fixture chapter. 1009 1010 1011- `#6742 <https://github.com/pytest-dev/pytest/issues/6742>`_: Expand first sentence on fixtures into a paragraph. 1012 1013 1014 1015Trivial/Internal Changes 1016------------------------ 1017 1018- `#6404 <https://github.com/pytest-dev/pytest/issues/6404>`_: Remove usage of ``parser`` module, deprecated in Python 3.9. 1019 1020 1021pytest 5.3.5 (2020-01-29) 1022========================= 1023 1024Bug Fixes 1025--------- 1026 1027- `#6517 <https://github.com/pytest-dev/pytest/issues/6517>`_: Fix regression in pytest 5.3.4 causing an INTERNALERROR due to a wrong assertion. 1028 1029 1030pytest 5.3.4 (2020-01-20) 1031========================= 1032 1033Bug Fixes 1034--------- 1035 1036- `#6496 <https://github.com/pytest-dev/pytest/issues/6496>`_: Revert `#6436 <https://github.com/pytest-dev/pytest/issues/6436>`__: unfortunately this change has caused a number of regressions in many suites, 1037 so the team decided to revert this change and make a new release while we continue to look for a solution. 1038 1039 1040pytest 5.3.3 (2020-01-16) 1041========================= 1042 1043Bug Fixes 1044--------- 1045 1046- `#2780 <https://github.com/pytest-dev/pytest/issues/2780>`_: Captured output during teardown is shown with ``-rP``. 1047 1048 1049- `#5971 <https://github.com/pytest-dev/pytest/issues/5971>`_: Fix a ``pytest-xdist`` crash when dealing with exceptions raised in subprocesses created by the 1050 ``multiprocessing`` module. 1051 1052 1053- `#6436 <https://github.com/pytest-dev/pytest/issues/6436>`_: :class:`FixtureDef <_pytest.fixtures.FixtureDef>` objects now properly register their finalizers with autouse and 1054 parameterized fixtures that execute before them in the fixture stack so they are torn 1055 down at the right times, and in the right order. 1056 1057 1058- `#6532 <https://github.com/pytest-dev/pytest/issues/6532>`_: Fix parsing of outcomes containing multiple errors with ``testdir`` results (regression in 5.3.0). 1059 1060 1061 1062Trivial/Internal Changes 1063------------------------ 1064 1065- `#6350 <https://github.com/pytest-dev/pytest/issues/6350>`_: Optimized automatic renaming of test parameter IDs. 1066 1067 1068pytest 5.3.2 (2019-12-13) 1069========================= 1070 1071Improvements 1072------------ 1073 1074- `#4639 <https://github.com/pytest-dev/pytest/issues/4639>`_: Revert "A warning is now issued when assertions are made for ``None``". 1075 1076 The warning proved to be less useful than initially expected and had quite a 1077 few false positive cases. 1078 1079 1080 1081Bug Fixes 1082--------- 1083 1084- `#5430 <https://github.com/pytest-dev/pytest/issues/5430>`_: junitxml: Logs for failed test are now passed to junit report in case the test fails during call phase. 1085 1086 1087- `#6290 <https://github.com/pytest-dev/pytest/issues/6290>`_: The supporting files in the ``.pytest_cache`` directory are kept with ``--cache-clear``, which only clears cached values now. 1088 1089 1090- `#6301 <https://github.com/pytest-dev/pytest/issues/6301>`_: Fix assertion rewriting for egg-based distributions and ``editable`` installs (``pip install --editable``). 1091 1092 1093pytest 5.3.1 (2019-11-25) 1094========================= 1095 1096Improvements 1097------------ 1098 1099- `#6231 <https://github.com/pytest-dev/pytest/issues/6231>`_: Improve check for misspelling of :ref:`pytest.mark.parametrize ref`. 1100 1101 1102- `#6257 <https://github.com/pytest-dev/pytest/issues/6257>`_: Handle :py:func:`pytest.exit` being used via :py:func:`~_pytest.hookspec.pytest_internalerror`, e.g. when quitting pdb from post mortem. 1103 1104 1105 1106Bug Fixes 1107--------- 1108 1109- `#5914 <https://github.com/pytest-dev/pytest/issues/5914>`_: pytester: fix :py:func:`~_pytest.pytester.LineMatcher.no_fnmatch_line` when used after positive matching. 1110 1111 1112- `#6082 <https://github.com/pytest-dev/pytest/issues/6082>`_: Fix line detection for doctest samples inside :py:class:`python:property` docstrings, as a workaround to `bpo-17446 <https://bugs.python.org/issue17446>`__. 1113 1114 1115- `#6254 <https://github.com/pytest-dev/pytest/issues/6254>`_: Fix compatibility with pytest-parallel (regression in pytest 5.3.0). 1116 1117 1118- `#6255 <https://github.com/pytest-dev/pytest/issues/6255>`_: Clear the :py:data:`sys.last_traceback`, :py:data:`sys.last_type` 1119 and :py:data:`sys.last_value` attributes by deleting them instead 1120 of setting them to ``None``. This better matches the behaviour of 1121 the Python standard library. 1122 1123 1124pytest 5.3.0 (2019-11-19) 1125========================= 1126 1127Deprecations 1128------------ 1129 1130- `#6179 <https://github.com/pytest-dev/pytest/issues/6179>`_: The default value of :confval:`junit_family` option will change to ``"xunit2"`` in pytest 6.0, given 1131 that this is the version supported by default in modern tools that manipulate this type of file. 1132 1133 In order to smooth the transition, pytest will issue a warning in case the ``--junitxml`` option 1134 is given in the command line but :confval:`junit_family` is not explicitly configured in ``pytest.ini``. 1135 1136 For more information, `see the docs <https://docs.pytest.org/en/stable/deprecations.html#junit-family-default-value-change-to-xunit2>`__. 1137 1138 1139 1140Features 1141-------- 1142 1143- `#4488 <https://github.com/pytest-dev/pytest/issues/4488>`_: The pytest team has created the `pytest-reportlog <https://github.com/pytest-dev/pytest-reportlog>`__ 1144 plugin, which provides a new ``--report-log=FILE`` option that writes *report logs* into a file as the test session executes. 1145 1146 Each line of the report log contains a self contained JSON object corresponding to a testing event, 1147 such as a collection or a test result report. The file is guaranteed to be flushed after writing 1148 each line, so systems can read and process events in real-time. 1149 1150 The plugin is meant to replace the ``--resultlog`` option, which is deprecated and meant to be removed 1151 in a future release. If you use ``--resultlog``, please try out ``pytest-reportlog`` and 1152 provide feedback. 1153 1154 1155- `#4730 <https://github.com/pytest-dev/pytest/issues/4730>`_: When :py:data:`sys.pycache_prefix` (Python 3.8+) is set, it will be used by pytest to cache test files changed by the assertion rewriting mechanism. 1156 1157 This makes it easier to benefit of cached ``.pyc`` files even on file systems without permissions. 1158 1159 1160- `#5515 <https://github.com/pytest-dev/pytest/issues/5515>`_: Allow selective auto-indentation of multiline log messages. 1161 1162 Adds command line option ``--log-auto-indent``, config option 1163 :confval:`log_auto_indent` and support for per-entry configuration of 1164 indentation behavior on calls to :py:func:`python:logging.log()`. 1165 1166 Alters the default for auto-indention from ``"on"`` to ``"off"``. This 1167 restores the older behavior that existed prior to v4.6.0. This 1168 reversion to earlier behavior was done because it is better to 1169 activate new features that may lead to broken tests explicitly 1170 rather than implicitly. 1171 1172 1173- `#5914 <https://github.com/pytest-dev/pytest/issues/5914>`_: :fixture:`testdir` learned two new functions, :py:func:`~_pytest.pytester.LineMatcher.no_fnmatch_line` and 1174 :py:func:`~_pytest.pytester.LineMatcher.no_re_match_line`. 1175 1176 The functions are used to ensure the captured text *does not* match the given 1177 pattern. 1178 1179 The previous idiom was to use :py:func:`python:re.match`: 1180 1181 .. code-block:: python 1182 1183 result = testdir.runpytest() 1184 assert re.match(pat, result.stdout.str()) is None 1185 1186 Or the ``in`` operator: 1187 1188 .. code-block:: python 1189 1190 result = testdir.runpytest() 1191 assert text in result.stdout.str() 1192 1193 But the new functions produce best output on failure. 1194 1195 1196- `#6057 <https://github.com/pytest-dev/pytest/issues/6057>`_: Added tolerances to complex values when printing ``pytest.approx``. 1197 1198 For example, ``repr(pytest.approx(3+4j))`` returns ``(3+4j) ± 5e-06 ∠ ±180°``. This is polar notation indicating a circle around the expected value, with a radius of 5e-06. For ``approx`` comparisons to return ``True``, the actual value should fall within this circle. 1199 1200 1201- `#6061 <https://github.com/pytest-dev/pytest/issues/6061>`_: Added the pluginmanager as an argument to ``pytest_addoption`` 1202 so that hooks can be invoked when setting up command line options. This is 1203 useful for having one plugin communicate things to another plugin, 1204 such as default values or which set of command line options to add. 1205 1206 1207 1208Improvements 1209------------ 1210 1211- `#5061 <https://github.com/pytest-dev/pytest/issues/5061>`_: Use multiple colors with terminal summary statistics. 1212 1213 1214- `#5630 <https://github.com/pytest-dev/pytest/issues/5630>`_: Quitting from debuggers is now properly handled in ``doctest`` items. 1215 1216 1217- `#5924 <https://github.com/pytest-dev/pytest/issues/5924>`_: Improved verbose diff output with sequences. 1218 1219 Before: 1220 1221 :: 1222 1223 E AssertionError: assert ['version', '...version_info'] == ['version', '...version', ...] 1224 E Right contains 3 more items, first extra item: ' ' 1225 E Full diff: 1226 E - ['version', 'version_info', 'sys.version', 'sys.version_info'] 1227 E + ['version', 1228 E + 'version_info', 1229 E + 'sys.version', 1230 E + 'sys.version_info', 1231 E + ' ', 1232 E + 'sys.version', 1233 E + 'sys.version_info'] 1234 1235 After: 1236 1237 :: 1238 1239 E AssertionError: assert ['version', '...version_info'] == ['version', '...version', ...] 1240 E Right contains 3 more items, first extra item: ' ' 1241 E Full diff: 1242 E [ 1243 E 'version', 1244 E 'version_info', 1245 E 'sys.version', 1246 E 'sys.version_info', 1247 E + ' ', 1248 E + 'sys.version', 1249 E + 'sys.version_info', 1250 E ] 1251 1252 1253- `#5934 <https://github.com/pytest-dev/pytest/issues/5934>`_: ``repr`` of ``ExceptionInfo`` objects has been improved to honor the ``__repr__`` method of the underlying exception. 1254 1255- `#5936 <https://github.com/pytest-dev/pytest/issues/5936>`_: Display untruncated assertion message with ``-vv``. 1256 1257 1258- `#5990 <https://github.com/pytest-dev/pytest/issues/5990>`_: Fixed plurality mismatch in test summary (e.g. display "1 error" instead of "1 errors"). 1259 1260 1261- `#6008 <https://github.com/pytest-dev/pytest/issues/6008>`_: ``Config.InvocationParams.args`` is now always a ``tuple`` to better convey that it should be 1262 immutable and avoid accidental modifications. 1263 1264 1265- `#6023 <https://github.com/pytest-dev/pytest/issues/6023>`_: ``pytest.main`` returns a ``pytest.ExitCode`` instance now, except for when custom exit codes are used (where it returns ``int`` then still). 1266 1267 1268- `#6026 <https://github.com/pytest-dev/pytest/issues/6026>`_: Align prefixes in output of pytester's ``LineMatcher``. 1269 1270 1271- `#6059 <https://github.com/pytest-dev/pytest/issues/6059>`_: Collection errors are reported as errors (and not failures like before) in the terminal's short test summary. 1272 1273 1274- `#6069 <https://github.com/pytest-dev/pytest/issues/6069>`_: ``pytester.spawn`` does not skip/xfail tests on FreeBSD anymore unconditionally. 1275 1276 1277- `#6097 <https://github.com/pytest-dev/pytest/issues/6097>`_: The "[...%]" indicator in the test summary is now colored according to the final (new) multi-colored line's main color. 1278 1279 1280- `#6116 <https://github.com/pytest-dev/pytest/issues/6116>`_: Added ``--co`` as a synonym to ``--collect-only``. 1281 1282 1283- `#6148 <https://github.com/pytest-dev/pytest/issues/6148>`_: ``atomicwrites`` is now only used on Windows, fixing a performance regression with assertion rewriting on Unix. 1284 1285 1286- `#6152 <https://github.com/pytest-dev/pytest/issues/6152>`_: Now parametrization will use the ``__name__`` attribute of any object for the id, if present. Previously it would only use ``__name__`` for functions and classes. 1287 1288 1289- `#6176 <https://github.com/pytest-dev/pytest/issues/6176>`_: Improved failure reporting with pytester's ``Hookrecorder.assertoutcome``. 1290 1291 1292- `#6181 <https://github.com/pytest-dev/pytest/issues/6181>`_: The reason for a stopped session, e.g. with ``--maxfail`` / ``-x``, now gets reported in the test summary. 1293 1294 1295- `#6206 <https://github.com/pytest-dev/pytest/issues/6206>`_: Improved ``cache.set`` robustness and performance. 1296 1297 1298 1299Bug Fixes 1300--------- 1301 1302- `#2049 <https://github.com/pytest-dev/pytest/issues/2049>`_: Fixed ``--setup-plan`` showing inaccurate information about fixture lifetimes. 1303 1304 1305- `#2548 <https://github.com/pytest-dev/pytest/issues/2548>`_: Fixed line offset mismatch of skipped tests in terminal summary. 1306 1307 1308- `#6039 <https://github.com/pytest-dev/pytest/issues/6039>`_: The ``PytestDoctestRunner`` is now properly invalidated when unconfiguring the doctest plugin. 1309 1310 This is important when used with ``pytester``'s ``runpytest_inprocess``. 1311 1312 1313- `#6047 <https://github.com/pytest-dev/pytest/issues/6047>`_: BaseExceptions are now handled in ``saferepr``, which includes ``pytest.fail.Exception`` etc. 1314 1315 1316- `#6074 <https://github.com/pytest-dev/pytest/issues/6074>`_: pytester: fixed order of arguments in ``rm_rf`` warning when cleaning up temporary directories, and do not emit warnings for errors with ``os.open``. 1317 1318 1319- `#6189 <https://github.com/pytest-dev/pytest/issues/6189>`_: Fixed result of ``getmodpath`` method. 1320 1321 1322 1323Trivial/Internal Changes 1324------------------------ 1325 1326- `#4901 <https://github.com/pytest-dev/pytest/issues/4901>`_: ``RunResult`` from ``pytester`` now displays the mnemonic of the ``ret`` attribute when it is a 1327 valid ``pytest.ExitCode`` value. 1328 1329 1330pytest 5.2.4 (2019-11-15) 1331========================= 1332 1333Bug Fixes 1334--------- 1335 1336- `#6194 <https://github.com/pytest-dev/pytest/issues/6194>`_: Fix incorrect discovery of non-test ``__init__.py`` files. 1337 1338 1339- `#6197 <https://github.com/pytest-dev/pytest/issues/6197>`_: Revert "The first test in a package (``__init__.py``) marked with ``@pytest.mark.skip`` is now correctly skipped.". 1340 1341 1342pytest 5.2.3 (2019-11-14) 1343========================= 1344 1345Bug Fixes 1346--------- 1347 1348- `#5830 <https://github.com/pytest-dev/pytest/issues/5830>`_: The first test in a package (``__init__.py``) marked with ``@pytest.mark.skip`` is now correctly skipped. 1349 1350 1351- `#6099 <https://github.com/pytest-dev/pytest/issues/6099>`_: Fix ``--trace`` when used with parametrized functions. 1352 1353 1354- `#6183 <https://github.com/pytest-dev/pytest/issues/6183>`_: Using ``request`` as a parameter name in ``@pytest.mark.parametrize`` now produces a more 1355 user-friendly error. 1356 1357 1358pytest 5.2.2 (2019-10-24) 1359========================= 1360 1361Bug Fixes 1362--------- 1363 1364- `#5206 <https://github.com/pytest-dev/pytest/issues/5206>`_: Fix ``--nf`` to not forget about known nodeids with partial test selection. 1365 1366 1367- `#5906 <https://github.com/pytest-dev/pytest/issues/5906>`_: Fix crash with ``KeyboardInterrupt`` during ``--setup-show``. 1368 1369 1370- `#5946 <https://github.com/pytest-dev/pytest/issues/5946>`_: Fixed issue when parametrizing fixtures with numpy arrays (and possibly other sequence-like types). 1371 1372 1373- `#6044 <https://github.com/pytest-dev/pytest/issues/6044>`_: Properly ignore ``FileNotFoundError`` exceptions when trying to remove old temporary directories, 1374 for instance when multiple processes try to remove the same directory (common with ``pytest-xdist`` 1375 for example). 1376 1377 1378pytest 5.2.1 (2019-10-06) 1379========================= 1380 1381Bug Fixes 1382--------- 1383 1384- `#5902 <https://github.com/pytest-dev/pytest/issues/5902>`_: Fix warnings about deprecated ``cmp`` attribute in ``attrs>=19.2``. 1385 1386 1387pytest 5.2.0 (2019-09-28) 1388========================= 1389 1390Deprecations 1391------------ 1392 1393- `#1682 <https://github.com/pytest-dev/pytest/issues/1682>`_: Passing arguments to pytest.fixture() as positional arguments is deprecated - pass them 1394 as a keyword argument instead. 1395 1396 1397 1398Features 1399-------- 1400 1401- `#1682 <https://github.com/pytest-dev/pytest/issues/1682>`_: The ``scope`` parameter of ``@pytest.fixture`` can now be a callable that receives 1402 the fixture name and the ``config`` object as keyword-only parameters. 1403 See `the docs <https://docs.pytest.org/en/stable/fixture.html#dynamic-scope>`__ for more information. 1404 1405 1406- `#5764 <https://github.com/pytest-dev/pytest/issues/5764>`_: New behavior of the ``--pastebin`` option: failures to connect to the pastebin server are reported, without failing the pytest run 1407 1408 1409 1410Bug Fixes 1411--------- 1412 1413- `#5806 <https://github.com/pytest-dev/pytest/issues/5806>`_: Fix "lexer" being used when uploading to bpaste.net from ``--pastebin`` to "text". 1414 1415 1416- `#5884 <https://github.com/pytest-dev/pytest/issues/5884>`_: Fix ``--setup-only`` and ``--setup-show`` for custom pytest items. 1417 1418 1419 1420Trivial/Internal Changes 1421------------------------ 1422 1423- `#5056 <https://github.com/pytest-dev/pytest/issues/5056>`_: The HelpFormatter uses ``py.io.get_terminal_width`` for better width detection. 1424 1425 1426pytest 5.1.3 (2019-09-18) 1427========================= 1428 1429Bug Fixes 1430--------- 1431 1432- `#5807 <https://github.com/pytest-dev/pytest/issues/5807>`_: Fix pypy3.6 (nightly) on windows. 1433 1434 1435- `#5811 <https://github.com/pytest-dev/pytest/issues/5811>`_: Handle ``--fulltrace`` correctly with ``pytest.raises``. 1436 1437 1438- `#5819 <https://github.com/pytest-dev/pytest/issues/5819>`_: Windows: Fix regression with conftest whose qualified name contains uppercase 1439 characters (introduced by #5792). 1440 1441 1442pytest 5.1.2 (2019-08-30) 1443========================= 1444 1445Bug Fixes 1446--------- 1447 1448- `#2270 <https://github.com/pytest-dev/pytest/issues/2270>`_: Fixed ``self`` reference in function-scoped fixtures defined plugin classes: previously ``self`` 1449 would be a reference to a *test* class, not the *plugin* class. 1450 1451 1452- `#570 <https://github.com/pytest-dev/pytest/issues/570>`_: Fixed long standing issue where fixture scope was not respected when indirect fixtures were used during 1453 parametrization. 1454 1455 1456- `#5782 <https://github.com/pytest-dev/pytest/issues/5782>`_: Fix decoding error when printing an error response from ``--pastebin``. 1457 1458 1459- `#5786 <https://github.com/pytest-dev/pytest/issues/5786>`_: Chained exceptions in test and collection reports are now correctly serialized, allowing plugins like 1460 ``pytest-xdist`` to display them properly. 1461 1462 1463- `#5792 <https://github.com/pytest-dev/pytest/issues/5792>`_: Windows: Fix error that occurs in certain circumstances when loading 1464 ``conftest.py`` from a working directory that has casing other than the one stored 1465 in the filesystem (e.g., ``c:\test`` instead of ``C:\test``). 1466 1467 1468pytest 5.1.1 (2019-08-20) 1469========================= 1470 1471Bug Fixes 1472--------- 1473 1474- `#5751 <https://github.com/pytest-dev/pytest/issues/5751>`_: Fixed ``TypeError`` when importing pytest on Python 3.5.0 and 3.5.1. 1475 1476 1477pytest 5.1.0 (2019-08-15) 1478========================= 1479 1480Removals 1481-------- 1482 1483- `#5180 <https://github.com/pytest-dev/pytest/issues/5180>`_: As per our policy, the following features have been deprecated in the 4.X series and are now 1484 removed: 1485 1486 * ``Request.getfuncargvalue``: use ``Request.getfixturevalue`` instead. 1487 1488 * ``pytest.raises`` and ``pytest.warns`` no longer support strings as the second argument. 1489 1490 * ``message`` parameter of ``pytest.raises``. 1491 1492 * ``pytest.raises``, ``pytest.warns`` and ``ParameterSet.param`` now use native keyword-only 1493 syntax. This might change the exception message from previous versions, but they still raise 1494 ``TypeError`` on unknown keyword arguments as before. 1495 1496 * ``pytest.config`` global variable. 1497 1498 * ``tmpdir_factory.ensuretemp`` method. 1499 1500 * ``pytest_logwarning`` hook. 1501 1502 * ``RemovedInPytest4Warning`` warning type. 1503 1504 * ``request`` is now a reserved name for fixtures. 1505 1506 1507 For more information consult 1508 `Deprecations and Removals <https://docs.pytest.org/en/stable/deprecations.html>`__ in the docs. 1509 1510 1511- `#5565 <https://github.com/pytest-dev/pytest/issues/5565>`_: Removed unused support code for `unittest2 <https://pypi.org/project/unittest2/>`__. 1512 1513 The ``unittest2`` backport module is no longer 1514 necessary since Python 3.3+, and the small amount of code in pytest to support it also doesn't seem 1515 to be used: after removed, all tests still pass unchanged. 1516 1517 Although our policy is to introduce a deprecation period before removing any features or support 1518 for third party libraries, because this code is apparently not used 1519 at all (even if ``unittest2`` is used by a test suite executed by pytest), it was decided to 1520 remove it in this release. 1521 1522 If you experience a regression because of this, please 1523 `file an issue <https://github.com/pytest-dev/pytest/issues/new>`__. 1524 1525 1526- `#5615 <https://github.com/pytest-dev/pytest/issues/5615>`_: ``pytest.fail``, ``pytest.xfail`` and ``pytest.skip`` no longer support bytes for the message argument. 1527 1528 This was supported for Python 2 where it was tempting to use ``"message"`` 1529 instead of ``u"message"``. 1530 1531 Python 3 code is unlikely to pass ``bytes`` to these functions. If you do, 1532 please decode it to an ``str`` beforehand. 1533 1534 1535 1536Features 1537-------- 1538 1539- `#5564 <https://github.com/pytest-dev/pytest/issues/5564>`_: New ``Config.invocation_args`` attribute containing the unchanged arguments passed to ``pytest.main()``. 1540 1541 1542- `#5576 <https://github.com/pytest-dev/pytest/issues/5576>`_: New `NUMBER <https://docs.pytest.org/en/stable/doctest.html#using-doctest-options>`__ 1543 option for doctests to ignore irrelevant differences in floating-point numbers. 1544 Inspired by Sébastien Boisgérault's `numtest <https://github.com/boisgera/numtest>`__ 1545 extension for doctest. 1546 1547 1548 1549Improvements 1550------------ 1551 1552- `#5471 <https://github.com/pytest-dev/pytest/issues/5471>`_: JUnit XML now includes a timestamp and hostname in the testsuite tag. 1553 1554 1555- `#5707 <https://github.com/pytest-dev/pytest/issues/5707>`_: Time taken to run the test suite now includes a human-readable representation when it takes over 1556 60 seconds, for example:: 1557 1558 ===== 2 failed in 102.70s (0:01:42) ===== 1559 1560 1561 1562Bug Fixes 1563--------- 1564 1565- `#4344 <https://github.com/pytest-dev/pytest/issues/4344>`_: Fix RuntimeError/StopIteration when trying to collect package with "__init__.py" only. 1566 1567 1568- `#5115 <https://github.com/pytest-dev/pytest/issues/5115>`_: Warnings issued during ``pytest_configure`` are explicitly not treated as errors, even if configured as such, because it otherwise completely breaks pytest. 1569 1570 1571- `#5477 <https://github.com/pytest-dev/pytest/issues/5477>`_: The XML file produced by ``--junitxml`` now correctly contain a ``<testsuites>`` root element. 1572 1573 1574- `#5524 <https://github.com/pytest-dev/pytest/issues/5524>`_: Fix issue where ``tmp_path`` and ``tmpdir`` would not remove directories containing files marked as read-only, 1575 which could lead to pytest crashing when executed a second time with the ``--basetemp`` option. 1576 1577 1578- `#5537 <https://github.com/pytest-dev/pytest/issues/5537>`_: Replace ``importlib_metadata`` backport with ``importlib.metadata`` from the 1579 standard library on Python 3.8+. 1580 1581 1582- `#5578 <https://github.com/pytest-dev/pytest/issues/5578>`_: Improve type checking for some exception-raising functions (``pytest.xfail``, ``pytest.skip``, etc) 1583 so they provide better error messages when users meant to use marks (for example ``@pytest.xfail`` 1584 instead of ``@pytest.mark.xfail``). 1585 1586 1587- `#5606 <https://github.com/pytest-dev/pytest/issues/5606>`_: Fixed internal error when test functions were patched with objects that cannot be compared 1588 for truth values against others, like ``numpy`` arrays. 1589 1590 1591- `#5634 <https://github.com/pytest-dev/pytest/issues/5634>`_: ``pytest.exit`` is now correctly handled in ``unittest`` cases. 1592 This makes ``unittest`` cases handle ``quit`` from pytest's pdb correctly. 1593 1594 1595- `#5650 <https://github.com/pytest-dev/pytest/issues/5650>`_: Improved output when parsing an ini configuration file fails. 1596 1597 1598- `#5701 <https://github.com/pytest-dev/pytest/issues/5701>`_: Fix collection of ``staticmethod`` objects defined with ``functools.partial``. 1599 1600 1601- `#5734 <https://github.com/pytest-dev/pytest/issues/5734>`_: Skip async generator test functions, and update the warning message to refer to ``async def`` functions. 1602 1603 1604 1605Improved Documentation 1606---------------------- 1607 1608- `#5669 <https://github.com/pytest-dev/pytest/issues/5669>`_: Add docstring for ``Testdir.copy_example``. 1609 1610 1611 1612Trivial/Internal Changes 1613------------------------ 1614 1615- `#5095 <https://github.com/pytest-dev/pytest/issues/5095>`_: XML files of the ``xunit2`` family are now validated against the schema by pytest's own test suite 1616 to avoid future regressions. 1617 1618 1619- `#5516 <https://github.com/pytest-dev/pytest/issues/5516>`_: Cache node splitting function which can improve collection performance in very large test suites. 1620 1621 1622- `#5603 <https://github.com/pytest-dev/pytest/issues/5603>`_: Simplified internal ``SafeRepr`` class and removed some dead code. 1623 1624 1625- `#5664 <https://github.com/pytest-dev/pytest/issues/5664>`_: When invoking pytest's own testsuite with ``PYTHONDONTWRITEBYTECODE=1``, 1626 the ``test_xfail_handling`` test no longer fails. 1627 1628 1629- `#5684 <https://github.com/pytest-dev/pytest/issues/5684>`_: Replace manual handling of ``OSError.errno`` in the codebase by new ``OSError`` subclasses (``PermissionError``, ``FileNotFoundError``, etc.). 1630 1631 1632pytest 5.0.1 (2019-07-04) 1633========================= 1634 1635Bug Fixes 1636--------- 1637 1638- `#5479 <https://github.com/pytest-dev/pytest/issues/5479>`_: Improve quoting in ``raises`` match failure message. 1639 1640 1641- `#5523 <https://github.com/pytest-dev/pytest/issues/5523>`_: Fixed using multiple short options together in the command-line (for example ``-vs``) in Python 3.8+. 1642 1643 1644- `#5547 <https://github.com/pytest-dev/pytest/issues/5547>`_: ``--step-wise`` now handles ``xfail(strict=True)`` markers properly. 1645 1646 1647 1648Improved Documentation 1649---------------------- 1650 1651- `#5517 <https://github.com/pytest-dev/pytest/issues/5517>`_: Improve "Declaring new hooks" section in chapter "Writing Plugins" 1652 1653 1654pytest 5.0.0 (2019-06-28) 1655========================= 1656 1657Important 1658--------- 1659 1660This release is a Python3.5+ only release. 1661 1662For more details, see our `Python 2.7 and 3.4 support plan <https://docs.pytest.org/en/stable/py27-py34-deprecation.html>`__. 1663 1664Removals 1665-------- 1666 1667- `#1149 <https://github.com/pytest-dev/pytest/issues/1149>`_: Pytest no longer accepts prefixes of command-line arguments, for example 1668 typing ``pytest --doctest-mod`` inplace of ``--doctest-modules``. 1669 This was previously allowed where the ``ArgumentParser`` thought it was unambiguous, 1670 but this could be incorrect due to delayed parsing of options for plugins. 1671 See for example issues `#1149 <https://github.com/pytest-dev/pytest/issues/1149>`__, 1672 `#3413 <https://github.com/pytest-dev/pytest/issues/3413>`__, and 1673 `#4009 <https://github.com/pytest-dev/pytest/issues/4009>`__. 1674 1675 1676- `#5402 <https://github.com/pytest-dev/pytest/issues/5402>`_: **PytestDeprecationWarning are now errors by default.** 1677 1678 Following our plan to remove deprecated features with as little disruption as 1679 possible, all warnings of type ``PytestDeprecationWarning`` now generate errors 1680 instead of warning messages. 1681 1682 **The affected features will be effectively removed in pytest 5.1**, so please consult the 1683 `Deprecations and Removals <https://docs.pytest.org/en/stable/deprecations.html>`__ 1684 section in the docs for directions on how to update existing code. 1685 1686 In the pytest ``5.0.X`` series, it is possible to change the errors back into warnings as a stop 1687 gap measure by adding this to your ``pytest.ini`` file: 1688 1689 .. code-block:: ini 1690 1691 [pytest] 1692 filterwarnings = 1693 ignore::pytest.PytestDeprecationWarning 1694 1695 But this will stop working when pytest ``5.1`` is released. 1696 1697 **If you have concerns** about the removal of a specific feature, please add a 1698 comment to `#5402 <https://github.com/pytest-dev/pytest/issues/5402>`__. 1699 1700 1701- `#5412 <https://github.com/pytest-dev/pytest/issues/5412>`_: ``ExceptionInfo`` objects (returned by ``pytest.raises``) now have the same ``str`` representation as ``repr``, which 1702 avoids some confusion when users use ``print(e)`` to inspect the object. 1703 1704 This means code like: 1705 1706 .. code-block:: python 1707 1708 with pytest.raises(SomeException) as e: 1709 ... 1710 assert "some message" in str(e) 1711 1712 1713 Needs to be changed to: 1714 1715 .. code-block:: python 1716 1717 with pytest.raises(SomeException) as e: 1718 ... 1719 assert "some message" in str(e.value) 1720 1721 1722 1723 1724Deprecations 1725------------ 1726 1727- `#4488 <https://github.com/pytest-dev/pytest/issues/4488>`_: The removal of the ``--result-log`` option and module has been postponed to (tentatively) pytest 6.0 as 1728 the team has not yet got around to implement a good alternative for it. 1729 1730 1731- `#466 <https://github.com/pytest-dev/pytest/issues/466>`_: The ``funcargnames`` attribute has been an alias for ``fixturenames`` since 1732 pytest 2.3, and is now deprecated in code too. 1733 1734 1735 1736Features 1737-------- 1738 1739- `#3457 <https://github.com/pytest-dev/pytest/issues/3457>`_: New `pytest_assertion_pass <https://docs.pytest.org/en/stable/reference.html#_pytest.hookspec.pytest_assertion_pass>`__ 1740 hook, called with context information when an assertion *passes*. 1741 1742 This hook is still **experimental** so use it with caution. 1743 1744 1745- `#5440 <https://github.com/pytest-dev/pytest/issues/5440>`_: The `faulthandler <https://docs.python.org/3/library/faulthandler.html>`__ standard library 1746 module is now enabled by default to help users diagnose crashes in C modules. 1747 1748 This functionality was provided by integrating the external 1749 `pytest-faulthandler <https://github.com/pytest-dev/pytest-faulthandler>`__ plugin into the core, 1750 so users should remove that plugin from their requirements if used. 1751 1752 For more information see the docs: https://docs.pytest.org/en/stable/usage.html#fault-handler 1753 1754 1755- `#5452 <https://github.com/pytest-dev/pytest/issues/5452>`_: When warnings are configured as errors, pytest warnings now appear as originating from ``pytest.`` instead of the internal ``_pytest.warning_types.`` module. 1756 1757 1758- `#5125 <https://github.com/pytest-dev/pytest/issues/5125>`_: ``Session.exitcode`` values are now coded in ``pytest.ExitCode``, an ``IntEnum``. This makes the exit code available for consumer code and are more explicit other than just documentation. User defined exit codes are still valid, but should be used with caution. 1759 1760 The team doesn't expect this change to break test suites or plugins in general, except in esoteric/specific scenarios. 1761 1762 **pytest-xdist** users should upgrade to ``1.29.0`` or later, as ``pytest-xdist`` required a compatibility fix because of this change. 1763 1764 1765 1766Bug Fixes 1767--------- 1768 1769- `#1403 <https://github.com/pytest-dev/pytest/issues/1403>`_: Switch from ``imp`` to ``importlib``. 1770 1771 1772- `#1671 <https://github.com/pytest-dev/pytest/issues/1671>`_: The name of the ``.pyc`` files cached by the assertion writer now includes the pytest version 1773 to avoid stale caches. 1774 1775 1776- `#2761 <https://github.com/pytest-dev/pytest/issues/2761>`_: Honor PEP 235 on case-insensitive file systems. 1777 1778 1779- `#5078 <https://github.com/pytest-dev/pytest/issues/5078>`_: Test module is no longer double-imported when using ``--pyargs``. 1780 1781 1782- `#5260 <https://github.com/pytest-dev/pytest/issues/5260>`_: Improved comparison of byte strings. 1783 1784 When comparing bytes, the assertion message used to show the byte numeric value when showing the differences:: 1785 1786 def test(): 1787 > assert b'spam' == b'eggs' 1788 E AssertionError: assert b'spam' == b'eggs' 1789 E At index 0 diff: 115 != 101 1790 E Use -v to get the full diff 1791 1792 It now shows the actual ascii representation instead, which is often more useful:: 1793 1794 def test(): 1795 > assert b'spam' == b'eggs' 1796 E AssertionError: assert b'spam' == b'eggs' 1797 E At index 0 diff: b's' != b'e' 1798 E Use -v to get the full diff 1799 1800 1801- `#5335 <https://github.com/pytest-dev/pytest/issues/5335>`_: Colorize level names when the level in the logging format is formatted using 1802 '%(levelname).Xs' (truncated fixed width alignment), where X is an integer. 1803 1804 1805- `#5354 <https://github.com/pytest-dev/pytest/issues/5354>`_: Fix ``pytest.mark.parametrize`` when the argvalues is an iterator. 1806 1807 1808- `#5370 <https://github.com/pytest-dev/pytest/issues/5370>`_: Revert unrolling of ``all()`` to fix ``NameError`` on nested comprehensions. 1809 1810 1811- `#5371 <https://github.com/pytest-dev/pytest/issues/5371>`_: Revert unrolling of ``all()`` to fix incorrect handling of generators with ``if``. 1812 1813 1814- `#5372 <https://github.com/pytest-dev/pytest/issues/5372>`_: Revert unrolling of ``all()`` to fix incorrect assertion when using ``all()`` in an expression. 1815 1816 1817- `#5383 <https://github.com/pytest-dev/pytest/issues/5383>`_: ``-q`` has again an impact on the style of the collected items 1818 (``--collect-only``) when ``--log-cli-level`` is used. 1819 1820 1821- `#5389 <https://github.com/pytest-dev/pytest/issues/5389>`_: Fix regressions of `#5063 <https://github.com/pytest-dev/pytest/pull/5063>`__ for ``importlib_metadata.PathDistribution`` which have their ``files`` attribute being ``None``. 1822 1823 1824- `#5390 <https://github.com/pytest-dev/pytest/issues/5390>`_: Fix regression where the ``obj`` attribute of ``TestCase`` items was no longer bound to methods. 1825 1826 1827- `#5404 <https://github.com/pytest-dev/pytest/issues/5404>`_: Emit a warning when attempting to unwrap a broken object raises an exception, 1828 for easier debugging (`#5080 <https://github.com/pytest-dev/pytest/issues/5080>`__). 1829 1830 1831- `#5432 <https://github.com/pytest-dev/pytest/issues/5432>`_: Prevent "already imported" warnings from assertion rewriter when invoking pytest in-process multiple times. 1832 1833 1834- `#5433 <https://github.com/pytest-dev/pytest/issues/5433>`_: Fix assertion rewriting in packages (``__init__.py``). 1835 1836 1837- `#5444 <https://github.com/pytest-dev/pytest/issues/5444>`_: Fix ``--stepwise`` mode when the first file passed on the command-line fails to collect. 1838 1839 1840- `#5482 <https://github.com/pytest-dev/pytest/issues/5482>`_: Fix bug introduced in 4.6.0 causing collection errors when passing 1841 more than 2 positional arguments to ``pytest.mark.parametrize``. 1842 1843 1844- `#5505 <https://github.com/pytest-dev/pytest/issues/5505>`_: Fix crash when discovery fails while using ``-p no:terminal``. 1845 1846 1847 1848Improved Documentation 1849---------------------- 1850 1851- `#5315 <https://github.com/pytest-dev/pytest/issues/5315>`_: Expand docs on mocking classes and dictionaries with ``monkeypatch``. 1852 1853 1854- `#5416 <https://github.com/pytest-dev/pytest/issues/5416>`_: Fix PytestUnknownMarkWarning in run/skip example. 1855 1856 1857pytest 4.6.9 (2020-01-04) 1858========================= 1859 1860Bug Fixes 1861--------- 1862 1863- `#6301 <https://github.com/pytest-dev/pytest/issues/6301>`_: Fix assertion rewriting for egg-based distributions and ``editable`` installs (``pip install --editable``). 1864 1865 1866pytest 4.6.8 (2019-12-19) 1867========================= 1868 1869Features 1870-------- 1871 1872- `#5471 <https://github.com/pytest-dev/pytest/issues/5471>`_: JUnit XML now includes a timestamp and hostname in the testsuite tag. 1873 1874 1875 1876Bug Fixes 1877--------- 1878 1879- `#5430 <https://github.com/pytest-dev/pytest/issues/5430>`_: junitxml: Logs for failed test are now passed to junit report in case the test fails during call phase. 1880 1881 1882 1883Trivial/Internal Changes 1884------------------------ 1885 1886- `#6345 <https://github.com/pytest-dev/pytest/issues/6345>`_: Pin ``colorama`` to ``0.4.1`` only for Python 3.4 so newer Python versions can still receive colorama updates. 1887 1888 1889pytest 4.6.7 (2019-12-05) 1890========================= 1891 1892Bug Fixes 1893--------- 1894 1895- `#5477 <https://github.com/pytest-dev/pytest/issues/5477>`_: The XML file produced by ``--junitxml`` now correctly contain a ``<testsuites>`` root element. 1896 1897 1898- `#6044 <https://github.com/pytest-dev/pytest/issues/6044>`_: Properly ignore ``FileNotFoundError`` (``OSError.errno == NOENT`` in Python 2) exceptions when trying to remove old temporary directories, 1899 for instance when multiple processes try to remove the same directory (common with ``pytest-xdist`` 1900 for example). 1901 1902 1903pytest 4.6.6 (2019-10-11) 1904========================= 1905 1906Bug Fixes 1907--------- 1908 1909- `#5523 <https://github.com/pytest-dev/pytest/issues/5523>`_: Fixed using multiple short options together in the command-line (for example ``-vs``) in Python 3.8+. 1910 1911 1912- `#5537 <https://github.com/pytest-dev/pytest/issues/5537>`_: Replace ``importlib_metadata`` backport with ``importlib.metadata`` from the 1913 standard library on Python 3.8+. 1914 1915 1916- `#5806 <https://github.com/pytest-dev/pytest/issues/5806>`_: Fix "lexer" being used when uploading to bpaste.net from ``--pastebin`` to "text". 1917 1918 1919- `#5902 <https://github.com/pytest-dev/pytest/issues/5902>`_: Fix warnings about deprecated ``cmp`` attribute in ``attrs>=19.2``. 1920 1921 1922 1923Trivial/Internal Changes 1924------------------------ 1925 1926- `#5801 <https://github.com/pytest-dev/pytest/issues/5801>`_: Fixes python version checks (detected by ``flake8-2020``) in case python4 becomes a thing. 1927 1928 1929pytest 4.6.5 (2019-08-05) 1930========================= 1931 1932Bug Fixes 1933--------- 1934 1935- `#4344 <https://github.com/pytest-dev/pytest/issues/4344>`_: Fix RuntimeError/StopIteration when trying to collect package with "__init__.py" only. 1936 1937 1938- `#5478 <https://github.com/pytest-dev/pytest/issues/5478>`_: Fix encode error when using unicode strings in exceptions with ``pytest.raises``. 1939 1940 1941- `#5524 <https://github.com/pytest-dev/pytest/issues/5524>`_: Fix issue where ``tmp_path`` and ``tmpdir`` would not remove directories containing files marked as read-only, 1942 which could lead to pytest crashing when executed a second time with the ``--basetemp`` option. 1943 1944 1945- `#5547 <https://github.com/pytest-dev/pytest/issues/5547>`_: ``--step-wise`` now handles ``xfail(strict=True)`` markers properly. 1946 1947 1948- `#5650 <https://github.com/pytest-dev/pytest/issues/5650>`_: Improved output when parsing an ini configuration file fails. 1949 1950pytest 4.6.4 (2019-06-28) 1951========================= 1952 1953Bug Fixes 1954--------- 1955 1956- `#5404 <https://github.com/pytest-dev/pytest/issues/5404>`_: Emit a warning when attempting to unwrap a broken object raises an exception, 1957 for easier debugging (`#5080 <https://github.com/pytest-dev/pytest/issues/5080>`__). 1958 1959 1960- `#5444 <https://github.com/pytest-dev/pytest/issues/5444>`_: Fix ``--stepwise`` mode when the first file passed on the command-line fails to collect. 1961 1962 1963- `#5482 <https://github.com/pytest-dev/pytest/issues/5482>`_: Fix bug introduced in 4.6.0 causing collection errors when passing 1964 more than 2 positional arguments to ``pytest.mark.parametrize``. 1965 1966 1967- `#5505 <https://github.com/pytest-dev/pytest/issues/5505>`_: Fix crash when discovery fails while using ``-p no:terminal``. 1968 1969 1970pytest 4.6.3 (2019-06-11) 1971========================= 1972 1973Bug Fixes 1974--------- 1975 1976- `#5383 <https://github.com/pytest-dev/pytest/issues/5383>`_: ``-q`` has again an impact on the style of the collected items 1977 (``--collect-only``) when ``--log-cli-level`` is used. 1978 1979 1980- `#5389 <https://github.com/pytest-dev/pytest/issues/5389>`_: Fix regressions of `#5063 <https://github.com/pytest-dev/pytest/pull/5063>`__ for ``importlib_metadata.PathDistribution`` which have their ``files`` attribute being ``None``. 1981 1982 1983- `#5390 <https://github.com/pytest-dev/pytest/issues/5390>`_: Fix regression where the ``obj`` attribute of ``TestCase`` items was no longer bound to methods. 1984 1985 1986pytest 4.6.2 (2019-06-03) 1987========================= 1988 1989Bug Fixes 1990--------- 1991 1992- `#5370 <https://github.com/pytest-dev/pytest/issues/5370>`_: Revert unrolling of ``all()`` to fix ``NameError`` on nested comprehensions. 1993 1994 1995- `#5371 <https://github.com/pytest-dev/pytest/issues/5371>`_: Revert unrolling of ``all()`` to fix incorrect handling of generators with ``if``. 1996 1997 1998- `#5372 <https://github.com/pytest-dev/pytest/issues/5372>`_: Revert unrolling of ``all()`` to fix incorrect assertion when using ``all()`` in an expression. 1999 2000 2001pytest 4.6.1 (2019-06-02) 2002========================= 2003 2004Bug Fixes 2005--------- 2006 2007- `#5354 <https://github.com/pytest-dev/pytest/issues/5354>`_: Fix ``pytest.mark.parametrize`` when the argvalues is an iterator. 2008 2009 2010- `#5358 <https://github.com/pytest-dev/pytest/issues/5358>`_: Fix assertion rewriting of ``all()`` calls to deal with non-generators. 2011 2012 2013pytest 4.6.0 (2019-05-31) 2014========================= 2015 2016Important 2017--------- 2018 2019The ``4.6.X`` series will be the last series to support **Python 2 and Python 3.4**. 2020 2021For more details, see our `Python 2.7 and 3.4 support plan <https://docs.pytest.org/en/stable/py27-py34-deprecation.html>`__. 2022 2023 2024Features 2025-------- 2026 2027- `#4559 <https://github.com/pytest-dev/pytest/issues/4559>`_: Added the ``junit_log_passing_tests`` ini value which can be used to enable or disable logging of passing test output in the Junit XML file. 2028 2029 2030- `#4956 <https://github.com/pytest-dev/pytest/issues/4956>`_: pytester's ``testdir.spawn`` uses ``tmpdir`` as HOME/USERPROFILE directory. 2031 2032 2033- `#5062 <https://github.com/pytest-dev/pytest/issues/5062>`_: Unroll calls to ``all`` to full for-loops with assertion rewriting for better failure messages, especially when using Generator Expressions. 2034 2035 2036- `#5063 <https://github.com/pytest-dev/pytest/issues/5063>`_: Switch from ``pkg_resources`` to ``importlib-metadata`` for entrypoint detection for improved performance and import time. 2037 2038 2039- `#5091 <https://github.com/pytest-dev/pytest/issues/5091>`_: The output for ini options in ``--help`` has been improved. 2040 2041 2042- `#5269 <https://github.com/pytest-dev/pytest/issues/5269>`_: ``pytest.importorskip`` includes the ``ImportError`` now in the default ``reason``. 2043 2044 2045- `#5311 <https://github.com/pytest-dev/pytest/issues/5311>`_: Captured logs that are output for each failing test are formatted using the 2046 ColoredLevelFormatter. 2047 2048 2049- `#5312 <https://github.com/pytest-dev/pytest/issues/5312>`_: Improved formatting of multiline log messages in Python 3. 2050 2051 2052 2053Bug Fixes 2054--------- 2055 2056- `#2064 <https://github.com/pytest-dev/pytest/issues/2064>`_: The debugging plugin imports the wrapped ``Pdb`` class (``--pdbcls``) on-demand now. 2057 2058 2059- `#4908 <https://github.com/pytest-dev/pytest/issues/4908>`_: The ``pytest_enter_pdb`` hook gets called with post-mortem (``--pdb``). 2060 2061 2062- `#5036 <https://github.com/pytest-dev/pytest/issues/5036>`_: Fix issue where fixtures dependent on other parametrized fixtures would be erroneously parametrized. 2063 2064 2065- `#5256 <https://github.com/pytest-dev/pytest/issues/5256>`_: Handle internal error due to a lone surrogate unicode character not being representable in Jython. 2066 2067 2068- `#5257 <https://github.com/pytest-dev/pytest/issues/5257>`_: Ensure that ``sys.stdout.mode`` does not include ``'b'`` as it is a text stream. 2069 2070 2071- `#5278 <https://github.com/pytest-dev/pytest/issues/5278>`_: Pytest's internal python plugin can be disabled using ``-p no:python`` again. 2072 2073 2074- `#5286 <https://github.com/pytest-dev/pytest/issues/5286>`_: Fix issue with ``disable_test_id_escaping_and_forfeit_all_rights_to_community_support`` option not working when using a list of test IDs in parametrized tests. 2075 2076 2077- `#5330 <https://github.com/pytest-dev/pytest/issues/5330>`_: Show the test module being collected when emitting ``PytestCollectionWarning`` messages for 2078 test classes with ``__init__`` and ``__new__`` methods to make it easier to pin down the problem. 2079 2080 2081- `#5333 <https://github.com/pytest-dev/pytest/issues/5333>`_: Fix regression in 4.5.0 with ``--lf`` not re-running all tests with known failures from non-selected tests. 2082 2083 2084 2085Improved Documentation 2086---------------------- 2087 2088- `#5250 <https://github.com/pytest-dev/pytest/issues/5250>`_: Expand docs on use of ``setenv`` and ``delenv`` with ``monkeypatch``. 2089 2090 2091pytest 4.5.0 (2019-05-11) 2092========================= 2093 2094Features 2095-------- 2096 2097- `#4826 <https://github.com/pytest-dev/pytest/issues/4826>`_: A warning is now emitted when unknown marks are used as a decorator. 2098 This is often due to a typo, which can lead to silently broken tests. 2099 2100 2101- `#4907 <https://github.com/pytest-dev/pytest/issues/4907>`_: Show XFail reason as part of JUnitXML message field. 2102 2103 2104- `#5013 <https://github.com/pytest-dev/pytest/issues/5013>`_: Messages from crash reports are displayed within test summaries now, truncated to the terminal width. 2105 2106 2107- `#5023 <https://github.com/pytest-dev/pytest/issues/5023>`_: New flag ``--strict-markers`` that triggers an error when unknown markers (e.g. those not registered using the `markers option`_ in the configuration file) are used in the test suite. 2108 2109 The existing ``--strict`` option has the same behavior currently, but can be augmented in the future for additional checks. 2110 2111 .. _`markers option`: https://docs.pytest.org/en/stable/reference.html#confval-markers 2112 2113 2114- `#5026 <https://github.com/pytest-dev/pytest/issues/5026>`_: Assertion failure messages for sequences and dicts contain the number of different items now. 2115 2116 2117- `#5034 <https://github.com/pytest-dev/pytest/issues/5034>`_: Improve reporting with ``--lf`` and ``--ff`` (run-last-failure). 2118 2119 2120- `#5035 <https://github.com/pytest-dev/pytest/issues/5035>`_: The ``--cache-show`` option/action accepts an optional glob to show only matching cache entries. 2121 2122 2123- `#5059 <https://github.com/pytest-dev/pytest/issues/5059>`_: Standard input (stdin) can be given to pytester's ``Testdir.run()`` and ``Testdir.popen()``. 2124 2125 2126- `#5068 <https://github.com/pytest-dev/pytest/issues/5068>`_: The ``-r`` option learnt about ``A`` to display all reports (including passed ones) in the short test summary. 2127 2128 2129- `#5108 <https://github.com/pytest-dev/pytest/issues/5108>`_: The short test summary is displayed after passes with output (``-rP``). 2130 2131 2132- `#5172 <https://github.com/pytest-dev/pytest/issues/5172>`_: The ``--last-failed`` (``--lf``) option got smarter and will now skip entire files if all tests 2133 of that test file have passed in previous runs, greatly speeding up collection. 2134 2135 2136- `#5177 <https://github.com/pytest-dev/pytest/issues/5177>`_: Introduce new specific warning ``PytestWarning`` subclasses to make it easier to filter warnings based on the class, rather than on the message. The new subclasses are: 2137 2138 2139 * ``PytestAssertRewriteWarning`` 2140 2141 * ``PytestCacheWarning`` 2142 2143 * ``PytestCollectionWarning`` 2144 2145 * ``PytestConfigWarning`` 2146 2147 * ``PytestUnhandledCoroutineWarning`` 2148 2149 * ``PytestUnknownMarkWarning`` 2150 2151 2152- `#5202 <https://github.com/pytest-dev/pytest/issues/5202>`_: New ``record_testsuite_property`` session-scoped fixture allows users to log ``<property>`` tags at the ``testsuite`` 2153 level with the ``junitxml`` plugin. 2154 2155 The generated XML is compatible with the latest xunit standard, contrary to 2156 the properties recorded by ``record_property`` and ``record_xml_attribute``. 2157 2158 2159- `#5214 <https://github.com/pytest-dev/pytest/issues/5214>`_: The default logging format has been changed to improve readability. Here is an 2160 example of a previous logging message:: 2161 2162 test_log_cli_enabled_disabled.py 3 CRITICAL critical message logged by test 2163 2164 This has now become:: 2165 2166 CRITICAL root:test_log_cli_enabled_disabled.py:3 critical message logged by test 2167 2168 The formatting can be changed through the `log_format <https://docs.pytest.org/en/stable/reference.html#confval-log_format>`__ configuration option. 2169 2170 2171- `#5220 <https://github.com/pytest-dev/pytest/issues/5220>`_: ``--fixtures`` now also shows fixture scope for scopes other than ``"function"``. 2172 2173 2174 2175Bug Fixes 2176--------- 2177 2178- `#5113 <https://github.com/pytest-dev/pytest/issues/5113>`_: Deselected items from plugins using ``pytest_collect_modifyitems`` as a hookwrapper are correctly reported now. 2179 2180 2181- `#5144 <https://github.com/pytest-dev/pytest/issues/5144>`_: With usage errors ``exitstatus`` is set to ``EXIT_USAGEERROR`` in the ``pytest_sessionfinish`` hook now as expected. 2182 2183 2184- `#5235 <https://github.com/pytest-dev/pytest/issues/5235>`_: ``outcome.exit`` is not used with ``EOF`` in the pdb wrapper anymore, but only with ``quit``. 2185 2186 2187 2188Improved Documentation 2189---------------------- 2190 2191- `#4935 <https://github.com/pytest-dev/pytest/issues/4935>`_: Expand docs on registering marks and the effect of ``--strict``. 2192 2193 2194 2195Trivial/Internal Changes 2196------------------------ 2197 2198- `#4942 <https://github.com/pytest-dev/pytest/issues/4942>`_: ``logging.raiseExceptions`` is not set to ``False`` anymore. 2199 2200 2201- `#5013 <https://github.com/pytest-dev/pytest/issues/5013>`_: pytest now depends on `wcwidth <https://pypi.org/project/wcwidth>`__ to properly track unicode character sizes for more precise terminal output. 2202 2203 2204- `#5059 <https://github.com/pytest-dev/pytest/issues/5059>`_: pytester's ``Testdir.popen()`` uses ``stdout`` and ``stderr`` via keyword arguments with defaults now (``subprocess.PIPE``). 2205 2206 2207- `#5069 <https://github.com/pytest-dev/pytest/issues/5069>`_: The code for the short test summary in the terminal was moved to the terminal plugin. 2208 2209 2210- `#5082 <https://github.com/pytest-dev/pytest/issues/5082>`_: Improved validation of kwargs for various methods in the pytester plugin. 2211 2212 2213- `#5202 <https://github.com/pytest-dev/pytest/issues/5202>`_: ``record_property`` now emits a ``PytestWarning`` when used with ``junit_family=xunit2``: the fixture generates 2214 ``property`` tags as children of ``testcase``, which is not permitted according to the most 2215 `recent schema <https://github.com/jenkinsci/xunit-plugin/blob/master/ 2216 src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd>`__. 2217 2218 2219- `#5239 <https://github.com/pytest-dev/pytest/issues/5239>`_: Pin ``pluggy`` to ``< 1.0`` so we don't update to ``1.0`` automatically when 2220 it gets released: there are planned breaking changes, and we want to ensure 2221 pytest properly supports ``pluggy 1.0``. 2222 2223 2224pytest 4.4.2 (2019-05-08) 2225========================= 2226 2227Bug Fixes 2228--------- 2229 2230- `#5089 <https://github.com/pytest-dev/pytest/issues/5089>`_: Fix crash caused by error in ``__repr__`` function with both ``showlocals`` and verbose output enabled. 2231 2232 2233- `#5139 <https://github.com/pytest-dev/pytest/issues/5139>`_: Eliminate core dependency on 'terminal' plugin. 2234 2235 2236- `#5229 <https://github.com/pytest-dev/pytest/issues/5229>`_: Require ``pluggy>=0.11.0`` which reverts a dependency to ``importlib-metadata`` added in ``0.10.0``. 2237 The ``importlib-metadata`` package cannot be imported when installed as an egg and causes issues when relying on ``setup.py`` to install test dependencies. 2238 2239 2240 2241Improved Documentation 2242---------------------- 2243 2244- `#5171 <https://github.com/pytest-dev/pytest/issues/5171>`_: Doc: ``pytest_ignore_collect``, ``pytest_collect_directory``, ``pytest_collect_file`` and ``pytest_pycollect_makemodule`` hooks's 'path' parameter documented type is now ``py.path.local`` 2245 2246 2247- `#5188 <https://github.com/pytest-dev/pytest/issues/5188>`_: Improve help for ``--runxfail`` flag. 2248 2249 2250 2251Trivial/Internal Changes 2252------------------------ 2253 2254- `#5182 <https://github.com/pytest-dev/pytest/issues/5182>`_: Removed internal and unused ``_pytest.deprecated.MARK_INFO_ATTRIBUTE``. 2255 2256 2257pytest 4.4.1 (2019-04-15) 2258========================= 2259 2260Bug Fixes 2261--------- 2262 2263- `#5031 <https://github.com/pytest-dev/pytest/issues/5031>`_: Environment variables are properly restored when using pytester's ``testdir`` fixture. 2264 2265 2266- `#5039 <https://github.com/pytest-dev/pytest/issues/5039>`_: Fix regression with ``--pdbcls``, which stopped working with local modules in 4.0.0. 2267 2268 2269- `#5092 <https://github.com/pytest-dev/pytest/issues/5092>`_: Produce a warning when unknown keywords are passed to ``pytest.param(...)``. 2270 2271 2272- `#5098 <https://github.com/pytest-dev/pytest/issues/5098>`_: Invalidate import caches with ``monkeypatch.syspath_prepend``, which is required with namespace packages being used. 2273 2274 2275pytest 4.4.0 (2019-03-29) 2276========================= 2277 2278Features 2279-------- 2280 2281- `#2224 <https://github.com/pytest-dev/pytest/issues/2224>`_: ``async`` test functions are skipped and a warning is emitted when a suitable 2282 async plugin is not installed (such as ``pytest-asyncio`` or ``pytest-trio``). 2283 2284 Previously ``async`` functions would not execute at all but still be marked as "passed". 2285 2286 2287- `#2482 <https://github.com/pytest-dev/pytest/issues/2482>`_: Include new ``disable_test_id_escaping_and_forfeit_all_rights_to_community_support`` option to disable ascii-escaping in parametrized values. This may cause a series of problems and as the name makes clear, use at your own risk. 2288 2289 2290- `#4718 <https://github.com/pytest-dev/pytest/issues/4718>`_: The ``-p`` option can now be used to early-load plugins also by entry-point name, instead of just 2291 by module name. 2292 2293 This makes it possible to early load external plugins like ``pytest-cov`` in the command-line:: 2294 2295 pytest -p pytest_cov 2296 2297 2298- `#4855 <https://github.com/pytest-dev/pytest/issues/4855>`_: The ``--pdbcls`` option handles classes via module attributes now (e.g. 2299 ``pdb:pdb.Pdb`` with `pdb++`_), and its validation was improved. 2300 2301 .. _pdb++: https://pypi.org/project/pdbpp/ 2302 2303 2304- `#4875 <https://github.com/pytest-dev/pytest/issues/4875>`_: The `testpaths <https://docs.pytest.org/en/stable/reference.html#confval-testpaths>`__ configuration option is now displayed next 2305 to the ``rootdir`` and ``inifile`` lines in the pytest header if the option is in effect, i.e., directories or file names were 2306 not explicitly passed in the command line. 2307 2308 Also, ``inifile`` is only displayed if there's a configuration file, instead of an empty ``inifile:`` string. 2309 2310 2311- `#4911 <https://github.com/pytest-dev/pytest/issues/4911>`_: Doctests can be skipped now dynamically using ``pytest.skip()``. 2312 2313 2314- `#4920 <https://github.com/pytest-dev/pytest/issues/4920>`_: Internal refactorings have been made in order to make the implementation of the 2315 `pytest-subtests <https://github.com/pytest-dev/pytest-subtests>`__ plugin 2316 possible, which adds unittest sub-test support and a new ``subtests`` fixture as discussed in 2317 `#1367 <https://github.com/pytest-dev/pytest/issues/1367>`__. 2318 2319 For details on the internal refactorings, please see the details on the related PR. 2320 2321 2322- `#4931 <https://github.com/pytest-dev/pytest/issues/4931>`_: pytester's ``LineMatcher`` asserts that the passed lines are a sequence. 2323 2324 2325- `#4936 <https://github.com/pytest-dev/pytest/issues/4936>`_: Handle ``-p plug`` after ``-p no:plug``. 2326 2327 This can be used to override a blocked plugin (e.g. in "addopts") from the 2328 command line etc. 2329 2330 2331- `#4951 <https://github.com/pytest-dev/pytest/issues/4951>`_: Output capturing is handled correctly when only capturing via fixtures (capsys, capfs) with ``pdb.set_trace()``. 2332 2333 2334- `#4956 <https://github.com/pytest-dev/pytest/issues/4956>`_: ``pytester`` sets ``$HOME`` and ``$USERPROFILE`` to the temporary directory during test runs. 2335 2336 This ensures to not load configuration files from the real user's home directory. 2337 2338 2339- `#4980 <https://github.com/pytest-dev/pytest/issues/4980>`_: Namespace packages are handled better with ``monkeypatch.syspath_prepend`` and ``testdir.syspathinsert`` (via ``pkg_resources.fixup_namespace_packages``). 2340 2341 2342- `#4993 <https://github.com/pytest-dev/pytest/issues/4993>`_: The stepwise plugin reports status information now. 2343 2344 2345- `#5008 <https://github.com/pytest-dev/pytest/issues/5008>`_: If a ``setup.cfg`` file contains ``[tool:pytest]`` and also the no longer supported ``[pytest]`` section, pytest will use ``[tool:pytest]`` ignoring ``[pytest]``. Previously it would unconditionally error out. 2346 2347 This makes it simpler for plugins to support old pytest versions. 2348 2349 2350 2351Bug Fixes 2352--------- 2353 2354- `#1895 <https://github.com/pytest-dev/pytest/issues/1895>`_: Fix bug where fixtures requested dynamically via ``request.getfixturevalue()`` might be teardown 2355 before the requesting fixture. 2356 2357 2358- `#4851 <https://github.com/pytest-dev/pytest/issues/4851>`_: pytester unsets ``PYTEST_ADDOPTS`` now to not use outer options with ``testdir.runpytest()``. 2359 2360 2361- `#4903 <https://github.com/pytest-dev/pytest/issues/4903>`_: Use the correct modified time for years after 2038 in rewritten ``.pyc`` files. 2362 2363 2364- `#4928 <https://github.com/pytest-dev/pytest/issues/4928>`_: Fix line offsets with ``ScopeMismatch`` errors. 2365 2366 2367- `#4957 <https://github.com/pytest-dev/pytest/issues/4957>`_: ``-p no:plugin`` is handled correctly for default (internal) plugins now, e.g. with ``-p no:capture``. 2368 2369 Previously they were loaded (imported) always, making e.g. the ``capfd`` fixture available. 2370 2371 2372- `#4968 <https://github.com/pytest-dev/pytest/issues/4968>`_: The pdb ``quit`` command is handled properly when used after the ``debug`` command with `pdb++`_. 2373 2374 .. _pdb++: https://pypi.org/project/pdbpp/ 2375 2376 2377- `#4975 <https://github.com/pytest-dev/pytest/issues/4975>`_: Fix the interpretation of ``-qq`` option where it was being considered as ``-v`` instead. 2378 2379 2380- `#4978 <https://github.com/pytest-dev/pytest/issues/4978>`_: ``outcomes.Exit`` is not swallowed in ``assertrepr_compare`` anymore. 2381 2382 2383- `#4988 <https://github.com/pytest-dev/pytest/issues/4988>`_: Close logging's file handler explicitly when the session finishes. 2384 2385 2386- `#5003 <https://github.com/pytest-dev/pytest/issues/5003>`_: Fix line offset with mark collection error (off by one). 2387 2388 2389 2390Improved Documentation 2391---------------------- 2392 2393- `#4974 <https://github.com/pytest-dev/pytest/issues/4974>`_: Update docs for ``pytest_cmdline_parse`` hook to note availability liminations 2394 2395 2396 2397Trivial/Internal Changes 2398------------------------ 2399 2400- `#4718 <https://github.com/pytest-dev/pytest/issues/4718>`_: ``pluggy>=0.9`` is now required. 2401 2402 2403- `#4815 <https://github.com/pytest-dev/pytest/issues/4815>`_: ``funcsigs>=1.0`` is now required for Python 2.7. 2404 2405 2406- `#4829 <https://github.com/pytest-dev/pytest/issues/4829>`_: Some left-over internal code related to ``yield`` tests has been removed. 2407 2408 2409- `#4890 <https://github.com/pytest-dev/pytest/issues/4890>`_: Remove internally unused ``anypython`` fixture from the pytester plugin. 2410 2411 2412- `#4912 <https://github.com/pytest-dev/pytest/issues/4912>`_: Remove deprecated Sphinx directive, ``add_description_unit()``, 2413 pin sphinx-removed-in to >= 0.2.0 to support Sphinx 2.0. 2414 2415 2416- `#4913 <https://github.com/pytest-dev/pytest/issues/4913>`_: Fix pytest tests invocation with custom ``PYTHONPATH``. 2417 2418 2419- `#4965 <https://github.com/pytest-dev/pytest/issues/4965>`_: New ``pytest_report_to_serializable`` and ``pytest_report_from_serializable`` **experimental** hooks. 2420 2421 These hooks will be used by ``pytest-xdist``, ``pytest-subtests``, and the replacement for 2422 resultlog to serialize and customize reports. 2423 2424 They are experimental, meaning that their details might change or even be removed 2425 completely in future patch releases without warning. 2426 2427 Feedback is welcome from plugin authors and users alike. 2428 2429 2430- `#4987 <https://github.com/pytest-dev/pytest/issues/4987>`_: ``Collector.repr_failure`` respects the ``--tb`` option, but only defaults to ``short`` now (with ``auto``). 2431 2432 2433pytest 4.3.1 (2019-03-11) 2434========================= 2435 2436Bug Fixes 2437--------- 2438 2439- `#4810 <https://github.com/pytest-dev/pytest/issues/4810>`_: Logging messages inside ``pytest_runtest_logreport()`` are now properly captured and displayed. 2440 2441 2442- `#4861 <https://github.com/pytest-dev/pytest/issues/4861>`_: Improve validation of contents written to captured output so it behaves the same as when capture is disabled. 2443 2444 2445- `#4898 <https://github.com/pytest-dev/pytest/issues/4898>`_: Fix ``AttributeError: FixtureRequest has no 'confg' attribute`` bug in ``testdir.copy_example``. 2446 2447 2448 2449Trivial/Internal Changes 2450------------------------ 2451 2452- `#4768 <https://github.com/pytest-dev/pytest/issues/4768>`_: Avoid pkg_resources import at the top-level. 2453 2454 2455pytest 4.3.0 (2019-02-16) 2456========================= 2457 2458Deprecations 2459------------ 2460 2461- `#4724 <https://github.com/pytest-dev/pytest/issues/4724>`_: ``pytest.warns()`` now emits a warning when it receives unknown keyword arguments. 2462 2463 This will be changed into an error in the future. 2464 2465 2466 2467Features 2468-------- 2469 2470- `#2753 <https://github.com/pytest-dev/pytest/issues/2753>`_: Usage errors from argparse are mapped to pytest's ``UsageError``. 2471 2472 2473- `#3711 <https://github.com/pytest-dev/pytest/issues/3711>`_: Add the ``--ignore-glob`` parameter to exclude test-modules with Unix shell-style wildcards. 2474 Add the :globalvar:`collect_ignore_glob` for ``conftest.py`` to exclude test-modules with Unix shell-style wildcards. 2475 2476 2477- `#4698 <https://github.com/pytest-dev/pytest/issues/4698>`_: The warning about Python 2.7 and 3.4 not being supported in pytest 5.0 has been removed. 2478 2479 In the end it was considered to be more 2480 of a nuisance than actual utility and users of those Python versions shouldn't have problems as ``pip`` will not 2481 install pytest 5.0 on those interpreters. 2482 2483 2484- `#4707 <https://github.com/pytest-dev/pytest/issues/4707>`_: With the help of new ``set_log_path()`` method there is a way to set ``log_file`` paths from hooks. 2485 2486 2487 2488Bug Fixes 2489--------- 2490 2491- `#4651 <https://github.com/pytest-dev/pytest/issues/4651>`_: ``--help`` and ``--version`` are handled with ``UsageError``. 2492 2493 2494- `#4782 <https://github.com/pytest-dev/pytest/issues/4782>`_: Fix ``AssertionError`` with collection of broken symlinks with packages. 2495 2496 2497pytest 4.2.1 (2019-02-12) 2498========================= 2499 2500Bug Fixes 2501--------- 2502 2503- `#2895 <https://github.com/pytest-dev/pytest/issues/2895>`_: The ``pytest_report_collectionfinish`` hook now is also called with ``--collect-only``. 2504 2505 2506- `#3899 <https://github.com/pytest-dev/pytest/issues/3899>`_: Do not raise ``UsageError`` when an imported package has a ``pytest_plugins.py`` child module. 2507 2508 2509- `#4347 <https://github.com/pytest-dev/pytest/issues/4347>`_: Fix output capturing when using pdb++ with recursive debugging. 2510 2511 2512- `#4592 <https://github.com/pytest-dev/pytest/issues/4592>`_: Fix handling of ``collect_ignore`` via parent ``conftest.py``. 2513 2514 2515- `#4700 <https://github.com/pytest-dev/pytest/issues/4700>`_: Fix regression where ``setUpClass`` would always be called in subclasses even if all tests 2516 were skipped by a ``unittest.skip()`` decorator applied in the subclass. 2517 2518 2519- `#4739 <https://github.com/pytest-dev/pytest/issues/4739>`_: Fix ``parametrize(... ids=<function>)`` when the function returns non-strings. 2520 2521 2522- `#4745 <https://github.com/pytest-dev/pytest/issues/4745>`_: Fix/improve collection of args when passing in ``__init__.py`` and a test file. 2523 2524 2525- `#4770 <https://github.com/pytest-dev/pytest/issues/4770>`_: ``more_itertools`` is now constrained to <6.0.0 when required for Python 2.7 compatibility. 2526 2527 2528- `#526 <https://github.com/pytest-dev/pytest/issues/526>`_: Fix "ValueError: Plugin already registered" exceptions when running in build directories that symlink to actual source. 2529 2530 2531 2532Improved Documentation 2533---------------------- 2534 2535- `#3899 <https://github.com/pytest-dev/pytest/issues/3899>`_: Add note to ``plugins.rst`` that ``pytest_plugins`` should not be used as a name for a user module containing plugins. 2536 2537 2538- `#4324 <https://github.com/pytest-dev/pytest/issues/4324>`_: Document how to use ``raises`` and ``does_not_raise`` to write parametrized tests with conditional raises. 2539 2540 2541- `#4709 <https://github.com/pytest-dev/pytest/issues/4709>`_: Document how to customize test failure messages when using 2542 ``pytest.warns``. 2543 2544 2545 2546Trivial/Internal Changes 2547------------------------ 2548 2549- `#4741 <https://github.com/pytest-dev/pytest/issues/4741>`_: Some verbosity related attributes of the TerminalReporter plugin are now 2550 read only properties. 2551 2552 2553pytest 4.2.0 (2019-01-30) 2554========================= 2555 2556Features 2557-------- 2558 2559- `#3094 <https://github.com/pytest-dev/pytest/issues/3094>`_: `Classic xunit-style <https://docs.pytest.org/en/stable/xunit_setup.html>`__ functions and methods 2560 now obey the scope of *autouse* fixtures. 2561 2562 This fixes a number of surprising issues like ``setup_method`` being called before session-scoped 2563 autouse fixtures (see `#517 <https://github.com/pytest-dev/pytest/issues/517>`__ for an example). 2564 2565 2566- `#4627 <https://github.com/pytest-dev/pytest/issues/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 2567 support those Python versions. 2568 2569 2570- `#4660 <https://github.com/pytest-dev/pytest/issues/4660>`_: The number of *selected* tests now are also displayed when the ``-k`` or ``-m`` flags are used. 2571 2572 2573- `#4688 <https://github.com/pytest-dev/pytest/issues/4688>`_: ``pytest_report_teststatus`` hook now can also receive a ``config`` parameter. 2574 2575 2576- `#4691 <https://github.com/pytest-dev/pytest/issues/4691>`_: ``pytest_terminal_summary`` hook now can also receive a ``config`` parameter. 2577 2578 2579 2580Bug Fixes 2581--------- 2582 2583- `#3547 <https://github.com/pytest-dev/pytest/issues/3547>`_: ``--junitxml`` can emit XML compatible with Jenkins xUnit. 2584 ``junit_family`` INI option accepts ``legacy|xunit1``, which produces old style output, and ``xunit2`` that conforms more strictly to https://github.com/jenkinsci/xunit-plugin/blob/xunit-2.3.2/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd 2585 2586 2587- `#4280 <https://github.com/pytest-dev/pytest/issues/4280>`_: Improve quitting from pdb, especially with ``--trace``. 2588 2589 Using ``q[quit]`` after ``pdb.set_trace()`` will quit pytest also. 2590 2591 2592- `#4402 <https://github.com/pytest-dev/pytest/issues/4402>`_: Warning summary now groups warnings by message instead of by test id. 2593 2594 This makes the output more compact and better conveys the general idea of how much code is 2595 actually generating warnings, instead of how many tests call that code. 2596 2597 2598- `#4536 <https://github.com/pytest-dev/pytest/issues/4536>`_: ``monkeypatch.delattr`` handles class descriptors like ``staticmethod``/``classmethod``. 2599 2600 2601- `#4649 <https://github.com/pytest-dev/pytest/issues/4649>`_: Restore marks being considered keywords for keyword expressions. 2602 2603 2604- `#4653 <https://github.com/pytest-dev/pytest/issues/4653>`_: ``tmp_path`` fixture and other related ones provides resolved path (a.k.a real path) 2605 2606 2607- `#4667 <https://github.com/pytest-dev/pytest/issues/4667>`_: ``pytest_terminal_summary`` uses result from ``pytest_report_teststatus`` hook, rather than hardcoded strings. 2608 2609 2610- `#4669 <https://github.com/pytest-dev/pytest/issues/4669>`_: Correctly handle ``unittest.SkipTest`` exception containing non-ascii characters on Python 2. 2611 2612 2613- `#4680 <https://github.com/pytest-dev/pytest/issues/4680>`_: Ensure the ``tmpdir`` and the ``tmp_path`` fixtures are the same folder. 2614 2615 2616- `#4681 <https://github.com/pytest-dev/pytest/issues/4681>`_: Ensure ``tmp_path`` is always a real path. 2617 2618 2619 2620Trivial/Internal Changes 2621------------------------ 2622 2623- `#4643 <https://github.com/pytest-dev/pytest/issues/4643>`_: Use ``a.item()`` instead of the deprecated ``np.asscalar(a)`` in ``pytest.approx``. 2624 2625 ``np.asscalar`` has been `deprecated <https://github.com/numpy/numpy/blob/master/doc/release/1.16.0-notes.rst#new-deprecations>`__ in ``numpy 1.16.``. 2626 2627 2628- `#4657 <https://github.com/pytest-dev/pytest/issues/4657>`_: Copy saferepr from pylib 2629 2630 2631- `#4668 <https://github.com/pytest-dev/pytest/issues/4668>`_: The verbose word for expected failures in the teststatus report changes from ``xfail`` to ``XFAIL`` to be consistent with other test outcomes. 2632 2633 2634pytest 4.1.1 (2019-01-12) 2635========================= 2636 2637Bug Fixes 2638--------- 2639 2640- `#2256 <https://github.com/pytest-dev/pytest/issues/2256>`_: Show full repr with ``assert a==b`` and ``-vv``. 2641 2642 2643- `#3456 <https://github.com/pytest-dev/pytest/issues/3456>`_: Extend Doctest-modules to ignore mock objects. 2644 2645 2646- `#4617 <https://github.com/pytest-dev/pytest/issues/4617>`_: Fixed ``pytest.warns`` bug when context manager is reused (e.g. multiple parametrization). 2647 2648 2649- `#4631 <https://github.com/pytest-dev/pytest/issues/4631>`_: Don't rewrite assertion when ``__getattr__`` is broken 2650 2651 2652 2653Improved Documentation 2654---------------------- 2655 2656- `#3375 <https://github.com/pytest-dev/pytest/issues/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. 2657 2658 2659 2660Trivial/Internal Changes 2661------------------------ 2662 2663- `#4602 <https://github.com/pytest-dev/pytest/issues/4602>`_: Uninstall ``hypothesis`` in regen tox env. 2664 2665 2666pytest 4.1.0 (2019-01-05) 2667========================= 2668 2669Removals 2670-------- 2671 2672- `#2169 <https://github.com/pytest-dev/pytest/issues/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. 2673 2674 2675- `#3078 <https://github.com/pytest-dev/pytest/issues/3078>`_: Remove legacy internal warnings system: ``config.warn``, ``Node.warn``. The ``pytest_logwarning`` now issues a warning when implemented. 2676 2677 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#config-warn-and-node-warn>`__ on information on how to update your code. 2678 2679 2680- `#3079 <https://github.com/pytest-dev/pytest/issues/3079>`_: Removed support for yield tests - they are fundamentally broken because they don't support fixtures properly since collection and test execution were separated. 2681 2682 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#yield-tests>`__ on information on how to update your code. 2683 2684 2685- `#3082 <https://github.com/pytest-dev/pytest/issues/3082>`_: Removed support for applying marks directly to values in ``@pytest.mark.parametrize``. Use ``pytest.param`` instead. 2686 2687 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#marks-in-pytest-mark-parametrize>`__ on information on how to update your code. 2688 2689 2690- `#3083 <https://github.com/pytest-dev/pytest/issues/3083>`_: Removed ``Metafunc.addcall``. This was the predecessor mechanism to ``@pytest.mark.parametrize``. 2691 2692 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#metafunc-addcall>`__ on information on how to update your code. 2693 2694 2695- `#3085 <https://github.com/pytest-dev/pytest/issues/3085>`_: Removed support for passing strings to ``pytest.main``. Now, always pass a list of strings instead. 2696 2697 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#passing-command-line-string-to-pytest-main>`__ on information on how to update your code. 2698 2699 2700- `#3086 <https://github.com/pytest-dev/pytest/issues/3086>`_: ``[pytest]`` section in **setup.cfg** files is no longer supported, use ``[tool:pytest]`` instead. ``setup.cfg`` files 2701 are meant for use with ``distutils``, and a section named ``pytest`` has notoriously been a source of conflicts and bugs. 2702 2703 Note that for **pytest.ini** and **tox.ini** files the section remains ``[pytest]``. 2704 2705 2706- `#3616 <https://github.com/pytest-dev/pytest/issues/3616>`_: Removed the deprecated compat properties for ``node.Class/Function/Module`` - use ``pytest.Class/Function/Module`` now. 2707 2708 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#internal-classes-accessed-through-node>`__ on information on how to update your code. 2709 2710 2711- `#4421 <https://github.com/pytest-dev/pytest/issues/4421>`_: Removed the implementation of the ``pytest_namespace`` hook. 2712 2713 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#pytest-namespace>`__ on information on how to update your code. 2714 2715 2716- `#4489 <https://github.com/pytest-dev/pytest/issues/4489>`_: Removed ``request.cached_setup``. This was the predecessor mechanism to modern fixtures. 2717 2718 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#cached-setup>`__ on information on how to update your code. 2719 2720 2721- `#4535 <https://github.com/pytest-dev/pytest/issues/4535>`_: Removed the deprecated ``PyCollector.makeitem`` method. This method was made public by mistake a long time ago. 2722 2723 2724- `#4543 <https://github.com/pytest-dev/pytest/issues/4543>`_: Removed support to define fixtures using the ``pytest_funcarg__`` prefix. Use the ``@pytest.fixture`` decorator instead. 2725 2726 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#pytest-funcarg-prefix>`__ on information on how to update your code. 2727 2728 2729- `#4545 <https://github.com/pytest-dev/pytest/issues/4545>`_: Calling fixtures directly is now always an error instead of a warning. 2730 2731 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#calling-fixtures-directly>`__ on information on how to update your code. 2732 2733 2734- `#4546 <https://github.com/pytest-dev/pytest/issues/4546>`_: Remove ``Node.get_marker(name)`` the return value was not usable for more than a existence check. 2735 2736 Use ``Node.get_closest_marker(name)`` as a replacement. 2737 2738 2739- `#4547 <https://github.com/pytest-dev/pytest/issues/4547>`_: The deprecated ``record_xml_property`` fixture has been removed, use the more generic ``record_property`` instead. 2740 2741 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#record-xml-property>`__ for more information. 2742 2743 2744- `#4548 <https://github.com/pytest-dev/pytest/issues/4548>`_: An error is now raised if the ``pytest_plugins`` variable is defined in a non-top-level ``conftest.py`` file (i.e., not residing in the ``rootdir``). 2745 2746 See our `docs <https://docs.pytest.org/en/stable/deprecations.html#pytest-plugins-in-non-top-level-conftest-files>`__ for more information. 2747 2748 2749- `#891 <https://github.com/pytest-dev/pytest/issues/891>`_: Remove ``testfunction.markername`` attributes - use ``Node.iter_markers(name=None)`` to iterate them. 2750 2751 2752 2753Deprecations 2754------------ 2755 2756- `#3050 <https://github.com/pytest-dev/pytest/issues/3050>`_: Deprecated the ``pytest.config`` global. 2757 2758 See https://docs.pytest.org/en/stable/deprecations.html#pytest-config-global for rationale. 2759 2760 2761- `#3974 <https://github.com/pytest-dev/pytest/issues/3974>`_: Passing the ``message`` parameter of ``pytest.raises`` now issues a ``DeprecationWarning``. 2762 2763 It is a common mistake to think this parameter will match the exception message, while in fact 2764 it only serves to provide a custom message in case the ``pytest.raises`` check fails. To avoid this 2765 mistake and because it is believed to be little used, pytest is deprecating it without providing 2766 an alternative for the moment. 2767 2768 If you have concerns about this, please comment on `issue #3974 <https://github.com/pytest-dev/pytest/issues/3974>`__. 2769 2770 2771- `#4435 <https://github.com/pytest-dev/pytest/issues/4435>`_: Deprecated ``raises(..., 'code(as_a_string)')`` and ``warns(..., 'code(as_a_string)')``. 2772 2773 See https://docs.pytest.org/en/stable/deprecations.html#raises-warns-exec for rationale and examples. 2774 2775 2776 2777Features 2778-------- 2779 2780- `#3191 <https://github.com/pytest-dev/pytest/issues/3191>`_: A warning is now issued when assertions are made for ``None``. 2781 2782 This is a common source of confusion among new users, which write: 2783 2784 .. code-block:: python 2785 2786 assert mocked_object.assert_called_with(3, 4, 5, key="value") 2787 2788 When they should write: 2789 2790 .. code-block:: python 2791 2792 mocked_object.assert_called_with(3, 4, 5, key="value") 2793 2794 Because the ``assert_called_with`` method of mock objects already executes an assertion. 2795 2796 This warning will not be issued when ``None`` is explicitly checked. An assertion like: 2797 2798 .. code-block:: python 2799 2800 assert variable is None 2801 2802 will not issue the warning. 2803 2804 2805- `#3632 <https://github.com/pytest-dev/pytest/issues/3632>`_: Richer equality comparison introspection on ``AssertionError`` for objects created using `attrs <http://www.attrs.org/en/stable/>`__ or `dataclasses <https://docs.python.org/3/library/dataclasses.html>`_ (Python 3.7+, `backported to 3.6 <https://pypi.org/project/dataclasses>`__). 2806 2807 2808- `#4278 <https://github.com/pytest-dev/pytest/issues/4278>`_: ``CACHEDIR.TAG`` files are now created inside cache directories. 2809 2810 Those files are part of the `Cache Directory Tagging Standard <http://www.bford.info/cachedir/spec.html>`__, and can 2811 be used by backup or synchronization programs to identify pytest's cache directory as such. 2812 2813 2814- `#4292 <https://github.com/pytest-dev/pytest/issues/4292>`_: ``pytest.outcomes.Exit`` is derived from ``SystemExit`` instead of ``KeyboardInterrupt``. This allows us to better handle ``pdb`` exiting. 2815 2816 2817- `#4371 <https://github.com/pytest-dev/pytest/issues/4371>`_: Updated the ``--collect-only`` option to display test descriptions when ran using ``--verbose``. 2818 2819 2820- `#4386 <https://github.com/pytest-dev/pytest/issues/4386>`_: Restructured ``ExceptionInfo`` object construction and ensure incomplete instances have a ``repr``/``str``. 2821 2822 2823- `#4416 <https://github.com/pytest-dev/pytest/issues/4416>`_: pdb: added support for keyword arguments with ``pdb.set_trace``. 2824 2825 It handles ``header`` similar to Python 3.7 does it, and forwards any 2826 other keyword arguments to the ``Pdb`` constructor. 2827 2828 This allows for ``__import__("pdb").set_trace(skip=["foo.*"])``. 2829 2830 2831- `#4483 <https://github.com/pytest-dev/pytest/issues/4483>`_: Added ini parameter ``junit_duration_report`` to optionally report test call durations, excluding setup and teardown times. 2832 2833 The JUnit XML specification and the default pytest behavior is to include setup and teardown times in the test duration 2834 report. You can include just the call durations instead (excluding setup and teardown) by adding this to your ``pytest.ini`` file: 2835 2836 .. code-block:: ini 2837 2838 [pytest] 2839 junit_duration_report = call 2840 2841 2842- `#4532 <https://github.com/pytest-dev/pytest/issues/4532>`_: ``-ra`` now will show errors and failures last, instead of as the first items in the summary. 2843 2844 This makes it easier to obtain a list of errors and failures to run tests selectively. 2845 2846 2847- `#4599 <https://github.com/pytest-dev/pytest/issues/4599>`_: ``pytest.importorskip`` now supports a ``reason`` parameter, which will be shown when the 2848 requested module cannot be imported. 2849 2850 2851 2852Bug Fixes 2853--------- 2854 2855- `#3532 <https://github.com/pytest-dev/pytest/issues/3532>`_: ``-p`` now accepts its argument without a space between the value, for example ``-pmyplugin``. 2856 2857 2858- `#4327 <https://github.com/pytest-dev/pytest/issues/4327>`_: ``approx`` again works with more generic containers, more precisely instances of ``Iterable`` and ``Sized`` instead of more restrictive ``Sequence``. 2859 2860 2861- `#4397 <https://github.com/pytest-dev/pytest/issues/4397>`_: Ensure that node ids are printable. 2862 2863 2864- `#4435 <https://github.com/pytest-dev/pytest/issues/4435>`_: Fixed ``raises(..., 'code(string)')`` frame filename. 2865 2866 2867- `#4458 <https://github.com/pytest-dev/pytest/issues/4458>`_: Display actual test ids in ``--collect-only``. 2868 2869 2870 2871Improved Documentation 2872---------------------- 2873 2874- `#4557 <https://github.com/pytest-dev/pytest/issues/4557>`_: Markers example documentation page updated to support latest pytest version. 2875 2876 2877- `#4558 <https://github.com/pytest-dev/pytest/issues/4558>`_: Update cache documentation example to correctly show cache hit and miss. 2878 2879 2880- `#4580 <https://github.com/pytest-dev/pytest/issues/4580>`_: Improved detailed summary report documentation. 2881 2882 2883 2884Trivial/Internal Changes 2885------------------------ 2886 2887- `#4447 <https://github.com/pytest-dev/pytest/issues/4447>`_: Changed the deprecation type of ``--result-log`` to ``PytestDeprecationWarning``. 2888 2889 It was decided to remove this feature at the next major revision. 2890 2891 2892pytest 4.0.2 (2018-12-13) 2893========================= 2894 2895Bug Fixes 2896--------- 2897 2898- `#4265 <https://github.com/pytest-dev/pytest/issues/4265>`_: Validate arguments from the ``PYTEST_ADDOPTS`` environment variable and the ``addopts`` ini option separately. 2899 2900 2901- `#4435 <https://github.com/pytest-dev/pytest/issues/4435>`_: Fix ``raises(..., 'code(string)')`` frame filename. 2902 2903 2904- `#4500 <https://github.com/pytest-dev/pytest/issues/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``. 2905 2906 2907- `#4538 <https://github.com/pytest-dev/pytest/issues/4538>`_: Raise ``TypeError`` for ``with raises(..., match=<non-None falsey value>)``. 2908 2909 2910 2911Improved Documentation 2912---------------------- 2913 2914- `#1495 <https://github.com/pytest-dev/pytest/issues/1495>`_: Document common doctest fixture directory tree structure pitfalls 2915 2916 2917pytest 4.0.1 (2018-11-23) 2918========================= 2919 2920Bug Fixes 2921--------- 2922 2923- `#3952 <https://github.com/pytest-dev/pytest/issues/3952>`_: Display warnings before "short test summary info" again, but still later warnings in the end. 2924 2925 2926- `#4386 <https://github.com/pytest-dev/pytest/issues/4386>`_: Handle uninitialized exceptioninfo in repr/str. 2927 2928 2929- `#4393 <https://github.com/pytest-dev/pytest/issues/4393>`_: Do not create ``.gitignore``/``README.md`` files in existing cache directories. 2930 2931 2932- `#4400 <https://github.com/pytest-dev/pytest/issues/4400>`_: Rearrange warning handling for the yield test errors so the opt-out in 4.0.x correctly works. 2933 2934 2935- `#4405 <https://github.com/pytest-dev/pytest/issues/4405>`_: Fix collection of testpaths with ``--pyargs``. 2936 2937 2938- `#4412 <https://github.com/pytest-dev/pytest/issues/4412>`_: Fix assertion rewriting involving ``Starred`` + side-effects. 2939 2940 2941- `#4425 <https://github.com/pytest-dev/pytest/issues/4425>`_: Ensure we resolve the absolute path when the given ``--basetemp`` is a relative path. 2942 2943 2944 2945Trivial/Internal Changes 2946------------------------ 2947 2948- `#4315 <https://github.com/pytest-dev/pytest/issues/4315>`_: Use ``pkg_resources.parse_version`` instead of ``LooseVersion`` in minversion check. 2949 2950 2951- `#4440 <https://github.com/pytest-dev/pytest/issues/4440>`_: Adjust the stack level of some internal pytest warnings. 2952 2953 2954pytest 4.0.0 (2018-11-13) 2955========================= 2956 2957Removals 2958-------- 2959 2960- `#3737 <https://github.com/pytest-dev/pytest/issues/3737>`_: **RemovedInPytest4Warnings are now errors by default.** 2961 2962 Following our plan to remove deprecated features with as little disruption as 2963 possible, all warnings of type ``RemovedInPytest4Warnings`` now generate errors 2964 instead of warning messages. 2965 2966 **The affected features will be effectively removed in pytest 4.1**, so please consult the 2967 `Deprecations and Removals <https://docs.pytest.org/en/stable/deprecations.html>`__ 2968 section in the docs for directions on how to update existing code. 2969 2970 In the pytest ``4.0.X`` series, it is possible to change the errors back into warnings as a stop 2971 gap measure by adding this to your ``pytest.ini`` file: 2972 2973 .. code-block:: ini 2974 2975 [pytest] 2976 filterwarnings = 2977 ignore::pytest.RemovedInPytest4Warning 2978 2979 But this will stop working when pytest ``4.1`` is released. 2980 2981 **If you have concerns** about the removal of a specific feature, please add a 2982 comment to `#4348 <https://github.com/pytest-dev/pytest/issues/4348>`__. 2983 2984 2985- `#4358 <https://github.com/pytest-dev/pytest/issues/4358>`_: Remove the ``::()`` notation to denote a test class instance in node ids. 2986 2987 Previously, node ids that contain test instances would use ``::()`` to denote the instance like this:: 2988 2989 test_foo.py::Test::()::test_bar 2990 2991 The extra ``::()`` was puzzling to most users and has been removed, so that the test id becomes now:: 2992 2993 test_foo.py::Test::test_bar 2994 2995 This change could not accompany a deprecation period as is usual when user-facing functionality changes because 2996 it was not really possible to detect when the functionality was being used explicitly. 2997 2998 The extra ``::()`` might have been removed in some places internally already, 2999 which then led to confusion in places where it was expected, e.g. with 3000 ``--deselect`` (`#4127 <https://github.com/pytest-dev/pytest/issues/4127>`_). 3001 3002 Test class instances are also not listed with ``--collect-only`` anymore. 3003 3004 3005 3006Features 3007-------- 3008 3009- `#4270 <https://github.com/pytest-dev/pytest/issues/4270>`_: The ``cache_dir`` option uses ``$TOX_ENV_DIR`` as prefix (if set in the environment). 3010 3011 This uses a different cache per tox environment by default. 3012 3013 3014 3015Bug Fixes 3016--------- 3017 3018- `#3554 <https://github.com/pytest-dev/pytest/issues/3554>`_: Fix ``CallInfo.__repr__`` for when the call is not finished yet. 3019 3020 3021pytest 3.10.1 (2018-11-11) 3022========================== 3023 3024Bug Fixes 3025--------- 3026 3027- `#4287 <https://github.com/pytest-dev/pytest/issues/4287>`_: Fix nested usage of debugging plugin (pdb), e.g. with pytester's ``testdir.runpytest``. 3028 3029 3030- `#4304 <https://github.com/pytest-dev/pytest/issues/4304>`_: Block the ``stepwise`` plugin if ``cacheprovider`` is also blocked, as one depends on the other. 3031 3032 3033- `#4306 <https://github.com/pytest-dev/pytest/issues/4306>`_: Parse ``minversion`` as an actual version and not as dot-separated strings. 3034 3035 3036- `#4310 <https://github.com/pytest-dev/pytest/issues/4310>`_: Fix duplicate collection due to multiple args matching the same packages. 3037 3038 3039- `#4321 <https://github.com/pytest-dev/pytest/issues/4321>`_: Fix ``item.nodeid`` with resolved symlinks. 3040 3041 3042- `#4325 <https://github.com/pytest-dev/pytest/issues/4325>`_: Fix collection of direct symlinked files, where the target does not match ``python_files``. 3043 3044 3045- `#4329 <https://github.com/pytest-dev/pytest/issues/4329>`_: Fix TypeError in report_collect with _collect_report_last_write. 3046 3047 3048 3049Trivial/Internal Changes 3050------------------------ 3051 3052- `#4305 <https://github.com/pytest-dev/pytest/issues/4305>`_: Replace byte/unicode helpers in test_capture with python level syntax. 3053 3054 3055pytest 3.10.0 (2018-11-03) 3056========================== 3057 3058Features 3059-------- 3060 3061- `#2619 <https://github.com/pytest-dev/pytest/issues/2619>`_: Resume capturing output after ``continue`` with ``__import__("pdb").set_trace()``. 3062 3063 This also adds a new ``pytest_leave_pdb`` hook, and passes in ``pdb`` to the 3064 existing ``pytest_enter_pdb`` hook. 3065 3066 3067- `#4147 <https://github.com/pytest-dev/pytest/issues/4147>`_: Add ``--sw``, ``--stepwise`` as an alternative to ``--lf -x`` for stopping at the first failure, but starting the next test invocation from that test. See `the documentation <https://docs.pytest.org/en/stable/cache.html#stepwise>`__ for more info. 3068 3069 3070- `#4188 <https://github.com/pytest-dev/pytest/issues/4188>`_: Make ``--color`` emit colorful dots when not running in verbose mode. Earlier, it would only colorize the test-by-test output if ``--verbose`` was also passed. 3071 3072 3073- `#4225 <https://github.com/pytest-dev/pytest/issues/4225>`_: Improve performance with collection reporting in non-quiet mode with terminals. 3074 3075 The "collecting …" message is only printed/updated every 0.5s. 3076 3077 3078 3079Bug Fixes 3080--------- 3081 3082- `#2701 <https://github.com/pytest-dev/pytest/issues/2701>`_: Fix false ``RemovedInPytest4Warning: usage of Session... is deprecated, please use pytest`` warnings. 3083 3084 3085- `#4046 <https://github.com/pytest-dev/pytest/issues/4046>`_: Fix problems with running tests in package ``__init__.py`` files. 3086 3087 3088- `#4260 <https://github.com/pytest-dev/pytest/issues/4260>`_: Swallow warnings during anonymous compilation of source. 3089 3090 3091- `#4262 <https://github.com/pytest-dev/pytest/issues/4262>`_: Fix access denied error when deleting stale directories created by ``tmpdir`` / ``tmp_path``. 3092 3093 3094- `#611 <https://github.com/pytest-dev/pytest/issues/611>`_: Naming a fixture ``request`` will now raise a warning: the ``request`` fixture is internal and 3095 should not be overwritten as it will lead to internal errors. 3096 3097- `#4266 <https://github.com/pytest-dev/pytest/issues/4266>`_: Handle (ignore) exceptions raised during collection, e.g. with Django's LazySettings proxy class. 3098 3099 3100 3101Improved Documentation 3102---------------------- 3103 3104- `#4255 <https://github.com/pytest-dev/pytest/issues/4255>`_: Added missing documentation about the fact that module names passed to filter warnings are not regex-escaped. 3105 3106 3107 3108Trivial/Internal Changes 3109------------------------ 3110 3111- `#4272 <https://github.com/pytest-dev/pytest/issues/4272>`_: Display cachedir also in non-verbose mode if non-default. 3112 3113 3114- `#4277 <https://github.com/pytest-dev/pytest/issues/4277>`_: pdb: improve message about output capturing with ``set_trace``. 3115 3116 Do not display "IO-capturing turned off/on" when ``-s`` is used to avoid 3117 confusion. 3118 3119 3120- `#4279 <https://github.com/pytest-dev/pytest/issues/4279>`_: Improve message and stack level of warnings issued by ``monkeypatch.setenv`` when the value of the environment variable is not a ``str``. 3121 3122 3123pytest 3.9.3 (2018-10-27) 3124========================= 3125 3126Bug Fixes 3127--------- 3128 3129- `#4174 <https://github.com/pytest-dev/pytest/issues/4174>`_: Fix "ValueError: Plugin already registered" with conftest plugins via symlink. 3130 3131 3132- `#4181 <https://github.com/pytest-dev/pytest/issues/4181>`_: Handle race condition between creation and deletion of temporary folders. 3133 3134 3135- `#4221 <https://github.com/pytest-dev/pytest/issues/4221>`_: Fix bug where the warning summary at the end of the test session was not showing the test where the warning was originated. 3136 3137 3138- `#4243 <https://github.com/pytest-dev/pytest/issues/4243>`_: Fix regression when ``stacklevel`` for warnings was passed as positional argument on python2. 3139 3140 3141 3142Improved Documentation 3143---------------------- 3144 3145- `#3851 <https://github.com/pytest-dev/pytest/issues/3851>`_: Add reference to ``empty_parameter_set_mark`` ini option in documentation of ``@pytest.mark.parametrize`` 3146 3147 3148 3149Trivial/Internal Changes 3150------------------------ 3151 3152- `#4028 <https://github.com/pytest-dev/pytest/issues/4028>`_: Revert patching of ``sys.breakpointhook`` since it appears to do nothing. 3153 3154 3155- `#4233 <https://github.com/pytest-dev/pytest/issues/4233>`_: Apply an import sorter (``reorder-python-imports``) to the codebase. 3156 3157 3158- `#4248 <https://github.com/pytest-dev/pytest/issues/4248>`_: Remove use of unnecessary compat shim, six.binary_type 3159 3160 3161pytest 3.9.2 (2018-10-22) 3162========================= 3163 3164Bug Fixes 3165--------- 3166 3167- `#2909 <https://github.com/pytest-dev/pytest/issues/2909>`_: Improve error message when a recursive dependency between fixtures is detected. 3168 3169 3170- `#3340 <https://github.com/pytest-dev/pytest/issues/3340>`_: Fix logging messages not shown in hooks ``pytest_sessionstart()`` and ``pytest_sessionfinish()``. 3171 3172 3173- `#3533 <https://github.com/pytest-dev/pytest/issues/3533>`_: Fix unescaped XML raw objects in JUnit report for skipped tests 3174 3175 3176- `#3691 <https://github.com/pytest-dev/pytest/issues/3691>`_: Python 2: safely format warning message about passing unicode strings to ``warnings.warn``, which may cause 3177 surprising ``MemoryError`` exception when monkey patching ``warnings.warn`` itself. 3178 3179 3180- `#4026 <https://github.com/pytest-dev/pytest/issues/4026>`_: Improve error message when it is not possible to determine a function's signature. 3181 3182 3183- `#4177 <https://github.com/pytest-dev/pytest/issues/4177>`_: Pin ``setuptools>=40.0`` to support ``py_modules`` in ``setup.cfg`` 3184 3185 3186- `#4179 <https://github.com/pytest-dev/pytest/issues/4179>`_: Restore the tmpdir behaviour of symlinking the current test run. 3187 3188 3189- `#4192 <https://github.com/pytest-dev/pytest/issues/4192>`_: Fix filename reported by ``warnings.warn`` when using ``recwarn`` under python2. 3190 3191 3192pytest 3.9.1 (2018-10-16) 3193========================= 3194 3195Features 3196-------- 3197 3198- `#4159 <https://github.com/pytest-dev/pytest/issues/4159>`_: For test-suites containing test classes, the information about the subclassed 3199 module is now output only if a higher verbosity level is specified (at least 3200 "-vv"). 3201 3202 3203pytest 3.9.0 (2018-10-15 - not published due to a release automation bug) 3204========================================================================= 3205 3206Deprecations 3207------------ 3208 3209- `#3616 <https://github.com/pytest-dev/pytest/issues/3616>`_: The following accesses have been documented as deprecated for years, but are now actually emitting deprecation warnings. 3210 3211 * Access of ``Module``, ``Function``, ``Class``, ``Instance``, ``File`` and ``Item`` through ``Node`` instances. Now 3212 users will this warning:: 3213 3214 usage of Function.Module is deprecated, please use pytest.Module instead 3215 3216 Users should just ``import pytest`` and access those objects using the ``pytest`` module. 3217 3218 * ``request.cached_setup``, this was the precursor of the setup/teardown mechanism available to fixtures. You can 3219 consult `funcarg comparison section in the docs <https://docs.pytest.org/en/stable/funcarg_compare.html>`_. 3220 3221 * Using objects named ``"Class"`` as a way to customize the type of nodes that are collected in ``Collector`` 3222 subclasses has been deprecated. Users instead should use ``pytest_collect_make_item`` to customize node types during 3223 collection. 3224 3225 This issue should affect only advanced plugins who create new collection types, so if you see this warning 3226 message please contact the authors so they can change the code. 3227 3228 * The warning that produces the message below has changed to ``RemovedInPytest4Warning``:: 3229 3230 getfuncargvalue is deprecated, use getfixturevalue 3231 3232 3233- `#3988 <https://github.com/pytest-dev/pytest/issues/3988>`_: Add a Deprecation warning for pytest.ensuretemp as it was deprecated since a while. 3234 3235 3236 3237Features 3238-------- 3239 3240- `#2293 <https://github.com/pytest-dev/pytest/issues/2293>`_: Improve usage errors messages by hiding internal details which can be distracting and noisy. 3241 3242 This has the side effect that some error conditions that previously raised generic errors (such as 3243 ``ValueError`` for unregistered marks) are now raising ``Failed`` exceptions. 3244 3245 3246- `#3332 <https://github.com/pytest-dev/pytest/issues/3332>`_: Improve the error displayed when a ``conftest.py`` file could not be imported. 3247 3248 In order to implement this, a new ``chain`` parameter was added to ``ExceptionInfo.getrepr`` 3249 to show or hide chained tracebacks in Python 3 (defaults to ``True``). 3250 3251 3252- `#3849 <https://github.com/pytest-dev/pytest/issues/3849>`_: Add ``empty_parameter_set_mark=fail_at_collect`` ini option for raising an exception when parametrize collects an empty set. 3253 3254 3255- `#3964 <https://github.com/pytest-dev/pytest/issues/3964>`_: Log messages generated in the collection phase are shown when 3256 live-logging is enabled and/or when they are logged to a file. 3257 3258 3259- `#3985 <https://github.com/pytest-dev/pytest/issues/3985>`_: Introduce ``tmp_path`` as a fixture providing a Path object. Also introduce ``tmp_path_factory`` as 3260 a session-scoped fixture for creating arbitrary temporary directories from any other fixture or test. 3261 3262 3263- `#4013 <https://github.com/pytest-dev/pytest/issues/4013>`_: Deprecation warnings are now shown even if you customize the warnings filters yourself. In the previous version 3264 any customization would override pytest's filters and deprecation warnings would fall back to being hidden by default. 3265 3266 3267- `#4073 <https://github.com/pytest-dev/pytest/issues/4073>`_: Allow specification of timeout for ``Testdir.runpytest_subprocess()`` and ``Testdir.run()``. 3268 3269 3270- `#4098 <https://github.com/pytest-dev/pytest/issues/4098>`_: Add returncode argument to pytest.exit() to exit pytest with a specific return code. 3271 3272 3273- `#4102 <https://github.com/pytest-dev/pytest/issues/4102>`_: Reimplement ``pytest.deprecated_call`` using ``pytest.warns`` so it supports the ``match='...'`` keyword argument. 3274 3275 This has the side effect that ``pytest.deprecated_call`` now raises ``pytest.fail.Exception`` instead 3276 of ``AssertionError``. 3277 3278 3279- `#4149 <https://github.com/pytest-dev/pytest/issues/4149>`_: Require setuptools>=30.3 and move most of the metadata to ``setup.cfg``. 3280 3281 3282 3283Bug Fixes 3284--------- 3285 3286- `#2535 <https://github.com/pytest-dev/pytest/issues/2535>`_: Improve error message when test functions of ``unittest.TestCase`` subclasses use a parametrized fixture. 3287 3288 3289- `#3057 <https://github.com/pytest-dev/pytest/issues/3057>`_: ``request.fixturenames`` now correctly returns the name of fixtures created by ``request.getfixturevalue()``. 3290 3291 3292- `#3946 <https://github.com/pytest-dev/pytest/issues/3946>`_: Warning filters passed as command line options using ``-W`` now take precedence over filters defined in ``ini`` 3293 configuration files. 3294 3295 3296- `#4066 <https://github.com/pytest-dev/pytest/issues/4066>`_: Fix source reindenting by using ``textwrap.dedent`` directly. 3297 3298 3299- `#4102 <https://github.com/pytest-dev/pytest/issues/4102>`_: ``pytest.warn`` will capture previously-warned warnings in Python 2. Previously they were never raised. 3300 3301 3302- `#4108 <https://github.com/pytest-dev/pytest/issues/4108>`_: Resolve symbolic links for args. 3303 3304 This fixes running ``pytest tests/test_foo.py::test_bar``, where ``tests`` 3305 is a symlink to ``project/app/tests``: 3306 previously ``project/app/conftest.py`` would be ignored for fixtures then. 3307 3308 3309- `#4132 <https://github.com/pytest-dev/pytest/issues/4132>`_: Fix duplicate printing of internal errors when using ``--pdb``. 3310 3311 3312- `#4135 <https://github.com/pytest-dev/pytest/issues/4135>`_: pathlib based tmpdir cleanup now correctly handles symlinks in the folder. 3313 3314 3315- `#4152 <https://github.com/pytest-dev/pytest/issues/4152>`_: Display the filename when encountering ``SyntaxWarning``. 3316 3317 3318 3319Improved Documentation 3320---------------------- 3321 3322- `#3713 <https://github.com/pytest-dev/pytest/issues/3713>`_: Update usefixtures documentation to clarify that it can't be used with fixture functions. 3323 3324 3325- `#4058 <https://github.com/pytest-dev/pytest/issues/4058>`_: Update fixture documentation to specify that a fixture can be invoked twice in the scope it's defined for. 3326 3327 3328- `#4064 <https://github.com/pytest-dev/pytest/issues/4064>`_: According to unittest.rst, setUpModule and tearDownModule were not implemented, but it turns out they are. So updated the documentation for unittest. 3329 3330 3331- `#4151 <https://github.com/pytest-dev/pytest/issues/4151>`_: Add tempir testing example to CONTRIBUTING.rst guide 3332 3333 3334 3335Trivial/Internal Changes 3336------------------------ 3337 3338- `#2293 <https://github.com/pytest-dev/pytest/issues/2293>`_: The internal ``MarkerError`` exception has been removed. 3339 3340 3341- `#3988 <https://github.com/pytest-dev/pytest/issues/3988>`_: Port the implementation of tmpdir to pathlib. 3342 3343 3344- `#4063 <https://github.com/pytest-dev/pytest/issues/4063>`_: Exclude 0.00 second entries from ``--duration`` output unless ``-vv`` is passed on the command-line. 3345 3346 3347- `#4093 <https://github.com/pytest-dev/pytest/issues/4093>`_: Fixed formatting of string literals in internal tests. 3348 3349 3350pytest 3.8.2 (2018-10-02) 3351========================= 3352 3353Deprecations and Removals 3354------------------------- 3355 3356- `#4036 <https://github.com/pytest-dev/pytest/issues/4036>`_: The ``item`` parameter of ``pytest_warning_captured`` hook is now documented as deprecated. We realized only after 3357 the ``3.8`` release that this parameter is incompatible with ``pytest-xdist``. 3358 3359 Our policy is to not deprecate features during bug-fix releases, but in this case we believe it makes sense as we are 3360 only documenting it as deprecated, without issuing warnings which might potentially break test suites. This will get 3361 the word out that hook implementers should not use this parameter at all. 3362 3363 In a future release ``item`` will always be ``None`` and will emit a proper warning when a hook implementation 3364 makes use of it. 3365 3366 3367 3368Bug Fixes 3369--------- 3370 3371- `#3539 <https://github.com/pytest-dev/pytest/issues/3539>`_: Fix reload on assertion rewritten modules. 3372 3373 3374- `#4034 <https://github.com/pytest-dev/pytest/issues/4034>`_: The ``.user_properties`` attribute of ``TestReport`` objects is a list 3375 of (name, value) tuples, but could sometimes be instantiated as a tuple 3376 of tuples. It is now always a list. 3377 3378 3379- `#4039 <https://github.com/pytest-dev/pytest/issues/4039>`_: No longer issue warnings about using ``pytest_plugins`` in non-top-level directories when using ``--pyargs``: the 3380 current ``--pyargs`` mechanism is not reliable and might give false negatives. 3381 3382 3383- `#4040 <https://github.com/pytest-dev/pytest/issues/4040>`_: Exclude empty reports for passed tests when ``-rP`` option is used. 3384 3385 3386- `#4051 <https://github.com/pytest-dev/pytest/issues/4051>`_: Improve error message when an invalid Python expression is passed to the ``-m`` option. 3387 3388 3389- `#4056 <https://github.com/pytest-dev/pytest/issues/4056>`_: ``MonkeyPatch.setenv`` and ``MonkeyPatch.delenv`` issue a warning if the environment variable name is not ``str`` on Python 2. 3390 3391 In Python 2, adding ``unicode`` keys to ``os.environ`` causes problems with ``subprocess`` (and possible other modules), 3392 making this a subtle bug specially susceptible when used with ``from __future__ import unicode_literals``. 3393 3394 3395 3396Improved Documentation 3397---------------------- 3398 3399- `#3928 <https://github.com/pytest-dev/pytest/issues/3928>`_: Add possible values for fixture scope to docs. 3400 3401 3402pytest 3.8.1 (2018-09-22) 3403========================= 3404 3405Bug Fixes 3406--------- 3407 3408- `#3286 <https://github.com/pytest-dev/pytest/issues/3286>`_: ``.pytest_cache`` directory is now automatically ignored by Git. Users who would like to contribute a solution for other SCMs please consult/comment on this issue. 3409 3410 3411- `#3749 <https://github.com/pytest-dev/pytest/issues/3749>`_: Fix the following error during collection of tests inside packages:: 3412 3413 TypeError: object of type 'Package' has no len() 3414 3415 3416- `#3941 <https://github.com/pytest-dev/pytest/issues/3941>`_: Fix bug where indirect parametrization would consider the scope of all fixtures used by the test function to determine the parametrization scope, and not only the scope of the fixtures being parametrized. 3417 3418 3419- `#3973 <https://github.com/pytest-dev/pytest/issues/3973>`_: Fix crash of the assertion rewriter if a test changed the current working directory without restoring it afterwards. 3420 3421 3422- `#3998 <https://github.com/pytest-dev/pytest/issues/3998>`_: Fix issue that prevented some caplog properties (for example ``record_tuples``) from being available when entering the debugger with ``--pdb``. 3423 3424 3425- `#3999 <https://github.com/pytest-dev/pytest/issues/3999>`_: Fix ``UnicodeDecodeError`` in python2.x when a class returns a non-ascii binary ``__repr__`` in an assertion which also contains non-ascii text. 3426 3427 3428 3429Improved Documentation 3430---------------------- 3431 3432- `#3996 <https://github.com/pytest-dev/pytest/issues/3996>`_: New `Deprecations and Removals <https://docs.pytest.org/en/stable/deprecations.html>`_ page shows all currently 3433 deprecated features, the rationale to do so, and alternatives to update your code. It also list features removed 3434 from pytest in past major releases to help those with ancient pytest versions to upgrade. 3435 3436 3437 3438Trivial/Internal Changes 3439------------------------ 3440 3441- `#3955 <https://github.com/pytest-dev/pytest/issues/3955>`_: Improve pre-commit detection for changelog filenames 3442 3443 3444- `#3975 <https://github.com/pytest-dev/pytest/issues/3975>`_: Remove legacy code around im_func as that was python2 only 3445 3446 3447pytest 3.8.0 (2018-09-05) 3448========================= 3449 3450Deprecations and Removals 3451------------------------- 3452 3453- `#2452 <https://github.com/pytest-dev/pytest/issues/2452>`_: ``Config.warn`` and ``Node.warn`` have been 3454 deprecated, see `<https://docs.pytest.org/en/stable/deprecations.html#config-warn-and-node-warn>`_ for rationale and 3455 examples. 3456 3457- `#3936 <https://github.com/pytest-dev/pytest/issues/3936>`_: ``@pytest.mark.filterwarnings`` second parameter is no longer regex-escaped, 3458 making it possible to actually use regular expressions to check the warning message. 3459 3460 **Note**: regex-escaping the match string was an implementation oversight that might break test suites which depend 3461 on the old behavior. 3462 3463 3464 3465Features 3466-------- 3467 3468- `#2452 <https://github.com/pytest-dev/pytest/issues/2452>`_: Internal pytest warnings are now issued using the standard ``warnings`` module, making it possible to use 3469 the standard warnings filters to manage those warnings. This introduces ``PytestWarning``, 3470 ``PytestDeprecationWarning`` and ``RemovedInPytest4Warning`` warning types as part of the public API. 3471 3472 Consult `the documentation <https://docs.pytest.org/en/stable/warnings.html#internal-pytest-warnings>`__ for more info. 3473 3474 3475- `#2908 <https://github.com/pytest-dev/pytest/issues/2908>`_: ``DeprecationWarning`` and ``PendingDeprecationWarning`` are now shown by default if no other warning filter is 3476 configured. This makes pytest more compliant with 3477 `PEP-0506 <https://www.python.org/dev/peps/pep-0565/#recommended-filter-settings-for-test-runners>`_. See 3478 `the docs <https://docs.pytest.org/en/stable/warnings.html#deprecationwarning-and-pendingdeprecationwarning>`_ for 3479 more info. 3480 3481 3482- `#3251 <https://github.com/pytest-dev/pytest/issues/3251>`_: Warnings are now captured and displayed during test collection. 3483 3484 3485- `#3784 <https://github.com/pytest-dev/pytest/issues/3784>`_: ``PYTEST_DISABLE_PLUGIN_AUTOLOAD`` environment variable disables plugin auto-loading when set. 3486 3487 3488- `#3829 <https://github.com/pytest-dev/pytest/issues/3829>`_: Added the ``count`` option to ``console_output_style`` to enable displaying the progress as a count instead of a percentage. 3489 3490 3491- `#3837 <https://github.com/pytest-dev/pytest/issues/3837>`_: Added support for 'xfailed' and 'xpassed' outcomes to the ``pytester.RunResult.assert_outcomes`` signature. 3492 3493 3494 3495Bug Fixes 3496--------- 3497 3498- `#3911 <https://github.com/pytest-dev/pytest/issues/3911>`_: Terminal writer now takes into account unicode character width when writing out progress. 3499 3500 3501- `#3913 <https://github.com/pytest-dev/pytest/issues/3913>`_: Pytest now returns with correct exit code (EXIT_USAGEERROR, 4) when called with unknown arguments. 3502 3503 3504- `#3918 <https://github.com/pytest-dev/pytest/issues/3918>`_: Improve performance of assertion rewriting. 3505 3506 3507 3508Improved Documentation 3509---------------------- 3510 3511- `#3566 <https://github.com/pytest-dev/pytest/issues/3566>`_: Added a blurb in usage.rst for the usage of -r flag which is used to show an extra test summary info. 3512 3513 3514- `#3907 <https://github.com/pytest-dev/pytest/issues/3907>`_: Corrected type of the exceptions collection passed to ``xfail``: ``raises`` argument accepts a ``tuple`` instead of ``list``. 3515 3516 3517 3518Trivial/Internal Changes 3519------------------------ 3520 3521- `#3853 <https://github.com/pytest-dev/pytest/issues/3853>`_: Removed ``"run all (no recorded failures)"`` message printed with ``--failed-first`` and ``--last-failed`` when there are no failed tests. 3522 3523 3524pytest 3.7.4 (2018-08-29) 3525========================= 3526 3527Bug Fixes 3528--------- 3529 3530- `#3506 <https://github.com/pytest-dev/pytest/issues/3506>`_: Fix possible infinite recursion when writing ``.pyc`` files. 3531 3532 3533- `#3853 <https://github.com/pytest-dev/pytest/issues/3853>`_: Cache plugin now obeys the ``-q`` flag when ``--last-failed`` and ``--failed-first`` flags are used. 3534 3535 3536- `#3883 <https://github.com/pytest-dev/pytest/issues/3883>`_: Fix bad console output when using ``console_output_style=classic``. 3537 3538 3539- `#3888 <https://github.com/pytest-dev/pytest/issues/3888>`_: Fix macOS specific code using ``capturemanager`` plugin in doctests. 3540 3541 3542 3543Improved Documentation 3544---------------------- 3545 3546- `#3902 <https://github.com/pytest-dev/pytest/issues/3902>`_: Fix pytest.org links 3547 3548 3549pytest 3.7.3 (2018-08-26) 3550========================= 3551 3552Bug Fixes 3553--------- 3554 3555- `#3033 <https://github.com/pytest-dev/pytest/issues/3033>`_: Fixtures during teardown can again use ``capsys`` and ``capfd`` to inspect output captured during tests. 3556 3557 3558- `#3773 <https://github.com/pytest-dev/pytest/issues/3773>`_: Fix collection of tests from ``__init__.py`` files if they match the ``python_files`` configuration option. 3559 3560 3561- `#3796 <https://github.com/pytest-dev/pytest/issues/3796>`_: Fix issue where teardown of fixtures of consecutive sub-packages were executed once, at the end of the outer 3562 package. 3563 3564 3565- `#3816 <https://github.com/pytest-dev/pytest/issues/3816>`_: Fix bug where ``--show-capture=no`` option would still show logs printed during fixture teardown. 3566 3567 3568- `#3819 <https://github.com/pytest-dev/pytest/issues/3819>`_: Fix ``stdout/stderr`` not getting captured when real-time cli logging is active. 3569 3570 3571- `#3843 <https://github.com/pytest-dev/pytest/issues/3843>`_: Fix collection error when specifying test functions directly in the command line using ``test.py::test`` syntax together with ``--doctest-modules``. 3572 3573 3574- `#3848 <https://github.com/pytest-dev/pytest/issues/3848>`_: Fix bugs where unicode arguments could not be passed to ``testdir.runpytest`` on Python 2. 3575 3576 3577- `#3854 <https://github.com/pytest-dev/pytest/issues/3854>`_: Fix double collection of tests within packages when the filename starts with a capital letter. 3578 3579 3580 3581Improved Documentation 3582---------------------- 3583 3584- `#3824 <https://github.com/pytest-dev/pytest/issues/3824>`_: Added example for multiple glob pattern matches in ``python_files``. 3585 3586 3587- `#3833 <https://github.com/pytest-dev/pytest/issues/3833>`_: Added missing docs for ``pytester.Testdir``. 3588 3589 3590- `#3870 <https://github.com/pytest-dev/pytest/issues/3870>`_: Correct documentation for setuptools integration. 3591 3592 3593 3594Trivial/Internal Changes 3595------------------------ 3596 3597- `#3826 <https://github.com/pytest-dev/pytest/issues/3826>`_: Replace broken type annotations with type comments. 3598 3599 3600- `#3845 <https://github.com/pytest-dev/pytest/issues/3845>`_: Remove a reference to issue `#568 <https://github.com/pytest-dev/pytest/issues/568>`_ from the documentation, which has since been 3601 fixed. 3602 3603 3604pytest 3.7.2 (2018-08-16) 3605========================= 3606 3607Bug Fixes 3608--------- 3609 3610- `#3671 <https://github.com/pytest-dev/pytest/issues/3671>`_: Fix ``filterwarnings`` not being registered as a builtin mark. 3611 3612 3613- `#3768 <https://github.com/pytest-dev/pytest/issues/3768>`_, `#3789 <https://github.com/pytest-dev/pytest/issues/3789>`_: Fix test collection from packages mixed with normal directories. 3614 3615 3616- `#3771 <https://github.com/pytest-dev/pytest/issues/3771>`_: Fix infinite recursion during collection if a ``pytest_ignore_collect`` hook returns ``False`` instead of ``None``. 3617 3618 3619- `#3774 <https://github.com/pytest-dev/pytest/issues/3774>`_: Fix bug where decorated fixtures would lose functionality (for example ``@mock.patch``). 3620 3621 3622- `#3775 <https://github.com/pytest-dev/pytest/issues/3775>`_: Fix bug where importing modules or other objects with prefix ``pytest_`` prefix would raise a ``PluginValidationError``. 3623 3624 3625- `#3788 <https://github.com/pytest-dev/pytest/issues/3788>`_: Fix ``AttributeError`` during teardown of ``TestCase`` subclasses which raise an exception during ``__init__``. 3626 3627 3628- `#3804 <https://github.com/pytest-dev/pytest/issues/3804>`_: Fix traceback reporting for exceptions with ``__cause__`` cycles. 3629 3630 3631 3632Improved Documentation 3633---------------------- 3634 3635- `#3746 <https://github.com/pytest-dev/pytest/issues/3746>`_: Add documentation for ``metafunc.config`` that had been mistakenly hidden. 3636 3637 3638pytest 3.7.1 (2018-08-02) 3639========================= 3640 3641Bug Fixes 3642--------- 3643 3644- `#3473 <https://github.com/pytest-dev/pytest/issues/3473>`_: Raise immediately if ``approx()`` is given an expected value of a type it doesn't understand (e.g. strings, nested dicts, etc.). 3645 3646 3647- `#3712 <https://github.com/pytest-dev/pytest/issues/3712>`_: Correctly represent the dimensions of a numpy array when calling ``repr()`` on ``approx()``. 3648 3649- `#3742 <https://github.com/pytest-dev/pytest/issues/3742>`_: Fix incompatibility with third party plugins during collection, which produced the error ``object has no attribute '_collectfile'``. 3650 3651- `#3745 <https://github.com/pytest-dev/pytest/issues/3745>`_: Display the absolute path if ``cache_dir`` is not relative to the ``rootdir`` instead of failing. 3652 3653 3654- `#3747 <https://github.com/pytest-dev/pytest/issues/3747>`_: Fix compatibility problem with plugins and the warning code issued by fixture functions when they are called directly. 3655 3656 3657- `#3748 <https://github.com/pytest-dev/pytest/issues/3748>`_: Fix infinite recursion in ``pytest.approx`` with arrays in ``numpy<1.13``. 3658 3659 3660- `#3757 <https://github.com/pytest-dev/pytest/issues/3757>`_: Pin pathlib2 to ``>=2.2.0`` as we require ``__fspath__`` support. 3661 3662 3663- `#3763 <https://github.com/pytest-dev/pytest/issues/3763>`_: Fix ``TypeError`` when the assertion message is ``bytes`` in python 3. 3664 3665 3666pytest 3.7.0 (2018-07-30) 3667========================= 3668 3669Deprecations and Removals 3670------------------------- 3671 3672- `#2639 <https://github.com/pytest-dev/pytest/issues/2639>`_: ``pytest_namespace`` has been `deprecated <https://docs.pytest.org/en/stable/deprecations.html#pytest-namespace>`_. 3673 3674 3675- `#3661 <https://github.com/pytest-dev/pytest/issues/3661>`_: Calling a fixture function directly, as opposed to request them in a test function, now issues a ``RemovedInPytest4Warning``. See `the documentation for rationale and examples <https://docs.pytest.org/en/stable/deprecations.html#calling-fixtures-directly>`_. 3676 3677 3678 3679Features 3680-------- 3681 3682- `#2283 <https://github.com/pytest-dev/pytest/issues/2283>`_: New ``package`` fixture scope: fixtures are finalized when the last test of a *package* finishes. This feature is considered **experimental**, so use it sparingly. 3683 3684 3685- `#3576 <https://github.com/pytest-dev/pytest/issues/3576>`_: ``Node.add_marker`` now supports an ``append=True/False`` parameter to determine whether the mark comes last (default) or first. 3686 3687 3688- `#3579 <https://github.com/pytest-dev/pytest/issues/3579>`_: Fixture ``caplog`` now has a ``messages`` property, providing convenient access to the format-interpolated log messages without the extra data provided by the formatter/handler. 3689 3690 3691- `#3610 <https://github.com/pytest-dev/pytest/issues/3610>`_: New ``--trace`` option to enter the debugger at the start of a test. 3692 3693 3694- `#3623 <https://github.com/pytest-dev/pytest/issues/3623>`_: Introduce ``pytester.copy_example`` as helper to do acceptance tests against examples from the project. 3695 3696 3697 3698Bug Fixes 3699--------- 3700 3701- `#2220 <https://github.com/pytest-dev/pytest/issues/2220>`_: Fix a bug where fixtures overridden by direct parameters (for example parametrization) were being instantiated even if they were not being used by a test. 3702 3703 3704- `#3695 <https://github.com/pytest-dev/pytest/issues/3695>`_: Fix ``ApproxNumpy`` initialisation argument mixup, ``abs`` and ``rel`` tolerances were flipped causing strange comparison results. 3705 Add tests to check ``abs`` and ``rel`` tolerances for ``np.array`` and test for expecting ``nan`` with ``np.array()`` 3706 3707 3708- `#980 <https://github.com/pytest-dev/pytest/issues/980>`_: Fix truncated locals output in verbose mode. 3709 3710 3711 3712Improved Documentation 3713---------------------- 3714 3715- `#3295 <https://github.com/pytest-dev/pytest/issues/3295>`_: Correct the usage documentation of ``--last-failed-no-failures`` by adding the missing ``--last-failed`` argument in the presented examples, because they are misleading and lead to think that the missing argument is not needed. 3716 3717 3718 3719Trivial/Internal Changes 3720------------------------ 3721 3722- `#3519 <https://github.com/pytest-dev/pytest/issues/3519>`_: Now a ``README.md`` file is created in ``.pytest_cache`` to make it clear why the directory exists. 3723 3724 3725pytest 3.6.4 (2018-07-28) 3726========================= 3727 3728Bug Fixes 3729--------- 3730 3731- Invoke pytest using ``-mpytest`` so ``sys.path`` does not get polluted by packages installed in ``site-packages``. (`#742 <https://github.com/pytest-dev/pytest/issues/742>`_) 3732 3733 3734Improved Documentation 3735---------------------- 3736 3737- Use ``smtp_connection`` instead of ``smtp`` in fixtures documentation to avoid possible confusion. (`#3592 <https://github.com/pytest-dev/pytest/issues/3592>`_) 3738 3739 3740Trivial/Internal Changes 3741------------------------ 3742 3743- Remove obsolete ``__future__`` imports. (`#2319 <https://github.com/pytest-dev/pytest/issues/2319>`_) 3744 3745- Add CITATION to provide information on how to formally cite pytest. (`#3402 <https://github.com/pytest-dev/pytest/issues/3402>`_) 3746 3747- Replace broken type annotations with type comments. (`#3635 <https://github.com/pytest-dev/pytest/issues/3635>`_) 3748 3749- Pin ``pluggy`` to ``<0.8``. (`#3727 <https://github.com/pytest-dev/pytest/issues/3727>`_) 3750 3751 3752pytest 3.6.3 (2018-07-04) 3753========================= 3754 3755Bug Fixes 3756--------- 3757 3758- Fix ``ImportWarning`` triggered by explicit relative imports in 3759 assertion-rewritten package modules. (`#3061 3760 <https://github.com/pytest-dev/pytest/issues/3061>`_) 3761 3762- Fix error in ``pytest.approx`` when dealing with 0-dimension numpy 3763 arrays. (`#3593 <https://github.com/pytest-dev/pytest/issues/3593>`_) 3764 3765- No longer raise ``ValueError`` when using the ``get_marker`` API. (`#3605 3766 <https://github.com/pytest-dev/pytest/issues/3605>`_) 3767 3768- Fix problem where log messages with non-ascii characters would not 3769 appear in the output log file. 3770 (`#3630 <https://github.com/pytest-dev/pytest/issues/3630>`_) 3771 3772- No longer raise ``AttributeError`` when legacy marks can't be stored in 3773 functions. (`#3631 <https://github.com/pytest-dev/pytest/issues/3631>`_) 3774 3775 3776Improved Documentation 3777---------------------- 3778 3779- The description above the example for ``@pytest.mark.skipif`` now better 3780 matches the code. (`#3611 3781 <https://github.com/pytest-dev/pytest/issues/3611>`_) 3782 3783 3784Trivial/Internal Changes 3785------------------------ 3786 3787- Internal refactoring: removed unused ``CallSpec2tox ._globalid_args`` 3788 attribute and ``metafunc`` parameter from ``CallSpec2.copy()``. (`#3598 3789 <https://github.com/pytest-dev/pytest/issues/3598>`_) 3790 3791- Silence usage of ``reduce`` warning in Python 2 (`#3609 3792 <https://github.com/pytest-dev/pytest/issues/3609>`_) 3793 3794- Fix usage of ``attr.ib`` deprecated ``convert`` parameter. (`#3653 3795 <https://github.com/pytest-dev/pytest/issues/3653>`_) 3796 3797 3798pytest 3.6.2 (2018-06-20) 3799========================= 3800 3801Bug Fixes 3802--------- 3803 3804- Fix regression in ``Node.add_marker`` by extracting the mark object of a 3805 ``MarkDecorator``. (`#3555 3806 <https://github.com/pytest-dev/pytest/issues/3555>`_) 3807 3808- Warnings without ``location`` were reported as ``None``. This is corrected to 3809 now report ``<undetermined location>``. (`#3563 3810 <https://github.com/pytest-dev/pytest/issues/3563>`_) 3811 3812- Continue to call finalizers in the stack when a finalizer in a former scope 3813 raises an exception. (`#3569 3814 <https://github.com/pytest-dev/pytest/issues/3569>`_) 3815 3816- Fix encoding error with ``print`` statements in doctests (`#3583 3817 <https://github.com/pytest-dev/pytest/issues/3583>`_) 3818 3819 3820Improved Documentation 3821---------------------- 3822 3823- Add documentation for the ``--strict`` flag. (`#3549 3824 <https://github.com/pytest-dev/pytest/issues/3549>`_) 3825 3826 3827Trivial/Internal Changes 3828------------------------ 3829 3830- Update old quotation style to parens in fixture.rst documentation. (`#3525 3831 <https://github.com/pytest-dev/pytest/issues/3525>`_) 3832 3833- Improve display of hint about ``--fulltrace`` with ``KeyboardInterrupt``. 3834 (`#3545 <https://github.com/pytest-dev/pytest/issues/3545>`_) 3835 3836- pytest's testsuite is no longer runnable through ``python setup.py test`` -- 3837 instead invoke ``pytest`` or ``tox`` directly. (`#3552 3838 <https://github.com/pytest-dev/pytest/issues/3552>`_) 3839 3840- Fix typo in documentation (`#3567 3841 <https://github.com/pytest-dev/pytest/issues/3567>`_) 3842 3843 3844pytest 3.6.1 (2018-06-05) 3845========================= 3846 3847Bug Fixes 3848--------- 3849 3850- Fixed a bug where stdout and stderr were logged twice by junitxml when a test 3851 was marked xfail. (`#3491 3852 <https://github.com/pytest-dev/pytest/issues/3491>`_) 3853 3854- Fix ``usefixtures`` mark applyed to unittest tests by correctly instantiating 3855 ``FixtureInfo``. (`#3498 3856 <https://github.com/pytest-dev/pytest/issues/3498>`_) 3857 3858- Fix assertion rewriter compatibility with libraries that monkey patch 3859 ``file`` objects. (`#3503 3860 <https://github.com/pytest-dev/pytest/issues/3503>`_) 3861 3862 3863Improved Documentation 3864---------------------- 3865 3866- Added a section on how to use fixtures as factories to the fixture 3867 documentation. (`#3461 <https://github.com/pytest-dev/pytest/issues/3461>`_) 3868 3869 3870Trivial/Internal Changes 3871------------------------ 3872 3873- Enable caching for pip/pre-commit in order to reduce build time on 3874 travis/appveyor. (`#3502 3875 <https://github.com/pytest-dev/pytest/issues/3502>`_) 3876 3877- Switch pytest to the src/ layout as we already suggested it for good practice 3878 - now we implement it as well. (`#3513 3879 <https://github.com/pytest-dev/pytest/issues/3513>`_) 3880 3881- Fix if in tests to support 3.7.0b5, where a docstring handling in AST got 3882 reverted. (`#3530 <https://github.com/pytest-dev/pytest/issues/3530>`_) 3883 3884- Remove some python2.5 compatibility code. (`#3529 3885 <https://github.com/pytest-dev/pytest/issues/3529>`_) 3886 3887 3888pytest 3.6.0 (2018-05-23) 3889========================= 3890 3891Features 3892-------- 3893 3894- Revamp the internals of the ``pytest.mark`` implementation with correct per 3895 node handling which fixes a number of long standing bugs caused by the old 3896 design. This introduces new ``Node.iter_markers(name)`` and 3897 ``Node.get_closest_marker(name)`` APIs. Users are **strongly encouraged** to 3898 read the `reasons for the revamp in the docs 3899 <https://docs.pytest.org/en/stable/historical-notes.html#marker-revamp-and-iteration>`_, 3900 or jump over to details about `updating existing code to use the new APIs 3901 <https://docs.pytest.org/en/stable/historical-notes.html#updating-code>`_. 3902 (`#3317 <https://github.com/pytest-dev/pytest/issues/3317>`_) 3903 3904- Now when ``@pytest.fixture`` is applied more than once to the same function a 3905 ``ValueError`` is raised. This buggy behavior would cause surprising problems 3906 and if was working for a test suite it was mostly by accident. (`#2334 3907 <https://github.com/pytest-dev/pytest/issues/2334>`_) 3908 3909- Support for Python 3.7's builtin ``breakpoint()`` method, see `Using the 3910 builtin breakpoint function 3911 <https://docs.pytest.org/en/stable/usage.html#breakpoint-builtin>`_ for 3912 details. (`#3180 <https://github.com/pytest-dev/pytest/issues/3180>`_) 3913 3914- ``monkeypatch`` now supports a ``context()`` function which acts as a context 3915 manager which undoes all patching done within the ``with`` block. (`#3290 3916 <https://github.com/pytest-dev/pytest/issues/3290>`_) 3917 3918- The ``--pdb`` option now causes KeyboardInterrupt to enter the debugger, 3919 instead of stopping the test session. On python 2.7, hitting CTRL+C again 3920 exits the debugger. On python 3.2 and higher, use CTRL+D. (`#3299 3921 <https://github.com/pytest-dev/pytest/issues/3299>`_) 3922 3923- pytest no longer changes the log level of the root logger when the 3924 ``log-level`` parameter has greater numeric value than that of the level of 3925 the root logger, which makes it play better with custom logging configuration 3926 in user code. (`#3307 <https://github.com/pytest-dev/pytest/issues/3307>`_) 3927 3928 3929Bug Fixes 3930--------- 3931 3932- A rare race-condition which might result in corrupted ``.pyc`` files on 3933 Windows has been hopefully solved. (`#3008 3934 <https://github.com/pytest-dev/pytest/issues/3008>`_) 3935 3936- Also use iter_marker for discovering the marks applying for marker 3937 expressions from the cli to avoid the bad data from the legacy mark storage. 3938 (`#3441 <https://github.com/pytest-dev/pytest/issues/3441>`_) 3939 3940- When showing diffs of failed assertions where the contents contain only 3941 whitespace, escape them using ``repr()`` first to make it easy to spot the 3942 differences. (`#3443 <https://github.com/pytest-dev/pytest/issues/3443>`_) 3943 3944 3945Improved Documentation 3946---------------------- 3947 3948- Change documentation copyright year to a range which auto-updates itself each 3949 time it is published. (`#3303 3950 <https://github.com/pytest-dev/pytest/issues/3303>`_) 3951 3952 3953Trivial/Internal Changes 3954------------------------ 3955 3956- ``pytest`` now depends on the `python-atomicwrites 3957 <https://github.com/untitaker/python-atomicwrites>`_ library. (`#3008 3958 <https://github.com/pytest-dev/pytest/issues/3008>`_) 3959 3960- Update all pypi.python.org URLs to pypi.org. (`#3431 3961 <https://github.com/pytest-dev/pytest/issues/3431>`_) 3962 3963- Detect `pytest_` prefixed hooks using the internal plugin manager since 3964 ``pluggy`` is deprecating the ``implprefix`` argument to ``PluginManager``. 3965 (`#3487 <https://github.com/pytest-dev/pytest/issues/3487>`_) 3966 3967- Import ``Mapping`` and ``Sequence`` from ``_pytest.compat`` instead of 3968 directly from ``collections`` in ``python_api.py::approx``. Add ``Mapping`` 3969 to ``_pytest.compat``, import it from ``collections`` on python 2, but from 3970 ``collections.abc`` on Python 3 to avoid a ``DeprecationWarning`` on Python 3971 3.7 or newer. (`#3497 <https://github.com/pytest-dev/pytest/issues/3497>`_) 3972 3973 3974pytest 3.5.1 (2018-04-23) 3975========================= 3976 3977 3978Bug Fixes 3979--------- 3980 3981- Reset ``sys.last_type``, ``sys.last_value`` and ``sys.last_traceback`` before 3982 each test executes. Those attributes are added by pytest during the test run 3983 to aid debugging, but were never reset so they would create a leaking 3984 reference to the last failing test's frame which in turn could never be 3985 reclaimed by the garbage collector. (`#2798 3986 <https://github.com/pytest-dev/pytest/issues/2798>`_) 3987 3988- ``pytest.raises`` now raises ``TypeError`` when receiving an unknown keyword 3989 argument. (`#3348 <https://github.com/pytest-dev/pytest/issues/3348>`_) 3990 3991- ``pytest.raises`` now works with exception classes that look like iterables. 3992 (`#3372 <https://github.com/pytest-dev/pytest/issues/3372>`_) 3993 3994 3995Improved Documentation 3996---------------------- 3997 3998- Fix typo in ``caplog`` fixture documentation, which incorrectly identified 3999 certain attributes as methods. (`#3406 4000 <https://github.com/pytest-dev/pytest/issues/3406>`_) 4001 4002 4003Trivial/Internal Changes 4004------------------------ 4005 4006- Added a more indicative error message when parametrizing a function whose 4007 argument takes a default value. (`#3221 4008 <https://github.com/pytest-dev/pytest/issues/3221>`_) 4009 4010- Remove internal ``_pytest.terminal.flatten`` function in favor of 4011 ``more_itertools.collapse``. (`#3330 4012 <https://github.com/pytest-dev/pytest/issues/3330>`_) 4013 4014- Import some modules from ``collections.abc`` instead of ``collections`` as 4015 the former modules trigger ``DeprecationWarning`` in Python 3.7. (`#3339 4016 <https://github.com/pytest-dev/pytest/issues/3339>`_) 4017 4018- record_property is no longer experimental, removing the warnings was 4019 forgotten. (`#3360 <https://github.com/pytest-dev/pytest/issues/3360>`_) 4020 4021- Mention in documentation and CLI help that fixtures with leading ``_`` are 4022 printed by ``pytest --fixtures`` only if the ``-v`` option is added. (`#3398 4023 <https://github.com/pytest-dev/pytest/issues/3398>`_) 4024 4025 4026pytest 3.5.0 (2018-03-21) 4027========================= 4028 4029Deprecations and Removals 4030------------------------- 4031 4032- ``record_xml_property`` fixture is now deprecated in favor of the more 4033 generic ``record_property``. (`#2770 4034 <https://github.com/pytest-dev/pytest/issues/2770>`_) 4035 4036- Defining ``pytest_plugins`` is now deprecated in non-top-level conftest.py 4037 files, because they "leak" to the entire directory tree. `See the docs <https://docs.pytest.org/en/stable/deprecations.html#pytest-plugins-in-non-top-level-conftest-files>`_ for the rationale behind this decision (`#3084 4038 <https://github.com/pytest-dev/pytest/issues/3084>`_) 4039 4040 4041Features 4042-------- 4043 4044- New ``--show-capture`` command-line option that allows to specify how to 4045 display captured output when tests fail: ``no``, ``stdout``, ``stderr``, 4046 ``log`` or ``all`` (the default). (`#1478 4047 <https://github.com/pytest-dev/pytest/issues/1478>`_) 4048 4049- New ``--rootdir`` command-line option to override the rules for discovering 4050 the root directory. See `customize 4051 <https://docs.pytest.org/en/stable/customize.html>`_ in the documentation for 4052 details. (`#1642 <https://github.com/pytest-dev/pytest/issues/1642>`_) 4053 4054- Fixtures are now instantiated based on their scopes, with higher-scoped 4055 fixtures (such as ``session``) being instantiated first than lower-scoped 4056 fixtures (such as ``function``). The relative order of fixtures of the same 4057 scope is kept unchanged, based in their declaration order and their 4058 dependencies. (`#2405 <https://github.com/pytest-dev/pytest/issues/2405>`_) 4059 4060- ``record_xml_property`` renamed to ``record_property`` and is now compatible 4061 with xdist, markers and any reporter. ``record_xml_property`` name is now 4062 deprecated. (`#2770 <https://github.com/pytest-dev/pytest/issues/2770>`_) 4063 4064- New ``--nf``, ``--new-first`` options: run new tests first followed by the 4065 rest of the tests, in both cases tests are also sorted by the file modified 4066 time, with more recent files coming first. (`#3034 4067 <https://github.com/pytest-dev/pytest/issues/3034>`_) 4068 4069- New ``--last-failed-no-failures`` command-line option that allows to specify 4070 the behavior of the cache plugin's ```--last-failed`` feature when no tests 4071 failed in the last run (or no cache was found): ``none`` or ``all`` (the 4072 default). (`#3139 <https://github.com/pytest-dev/pytest/issues/3139>`_) 4073 4074- New ``--doctest-continue-on-failure`` command-line option to enable doctests 4075 to show multiple failures for each snippet, instead of stopping at the first 4076 failure. (`#3149 <https://github.com/pytest-dev/pytest/issues/3149>`_) 4077 4078- Captured log messages are added to the ``<system-out>`` tag in the generated 4079 junit xml file if the ``junit_logging`` ini option is set to ``system-out``. 4080 If the value of this ini option is ``system-err``, the logs are written to 4081 ``<system-err>``. The default value for ``junit_logging`` is ``no``, meaning 4082 captured logs are not written to the output file. (`#3156 4083 <https://github.com/pytest-dev/pytest/issues/3156>`_) 4084 4085- Allow the logging plugin to handle ``pytest_runtest_logstart`` and 4086 ``pytest_runtest_logfinish`` hooks when live logs are enabled. (`#3189 4087 <https://github.com/pytest-dev/pytest/issues/3189>`_) 4088 4089- Passing ``--log-cli-level`` in the command-line now automatically activates 4090 live logging. (`#3190 <https://github.com/pytest-dev/pytest/issues/3190>`_) 4091 4092- Add command line option ``--deselect`` to allow deselection of individual 4093 tests at collection time. (`#3198 4094 <https://github.com/pytest-dev/pytest/issues/3198>`_) 4095 4096- Captured logs are printed before entering pdb. (`#3204 4097 <https://github.com/pytest-dev/pytest/issues/3204>`_) 4098 4099- Deselected item count is now shown before tests are run, e.g. ``collected X 4100 items / Y deselected``. (`#3213 4101 <https://github.com/pytest-dev/pytest/issues/3213>`_) 4102 4103- The builtin module ``platform`` is now available for use in expressions in 4104 ``pytest.mark``. (`#3236 4105 <https://github.com/pytest-dev/pytest/issues/3236>`_) 4106 4107- The *short test summary info* section now is displayed after tracebacks and 4108 warnings in the terminal. (`#3255 4109 <https://github.com/pytest-dev/pytest/issues/3255>`_) 4110 4111- New ``--verbosity`` flag to set verbosity level explicitly. (`#3296 4112 <https://github.com/pytest-dev/pytest/issues/3296>`_) 4113 4114- ``pytest.approx`` now accepts comparing a numpy array with a scalar. (`#3312 4115 <https://github.com/pytest-dev/pytest/issues/3312>`_) 4116 4117 4118Bug Fixes 4119--------- 4120 4121- Suppress ``IOError`` when closing the temporary file used for capturing 4122 streams in Python 2.7. (`#2370 4123 <https://github.com/pytest-dev/pytest/issues/2370>`_) 4124 4125- Fixed ``clear()`` method on ``caplog`` fixture which cleared ``records``, but 4126 not the ``text`` property. (`#3297 4127 <https://github.com/pytest-dev/pytest/issues/3297>`_) 4128 4129- During test collection, when stdin is not allowed to be read, the 4130 ``DontReadFromStdin`` object still allow itself to be iterable and resolved 4131 to an iterator without crashing. (`#3314 4132 <https://github.com/pytest-dev/pytest/issues/3314>`_) 4133 4134 4135Improved Documentation 4136---------------------- 4137 4138- Added a `reference <https://docs.pytest.org/en/stable/reference.html>`_ page 4139 to the docs. (`#1713 <https://github.com/pytest-dev/pytest/issues/1713>`_) 4140 4141 4142Trivial/Internal Changes 4143------------------------ 4144 4145- Change minimum requirement of ``attrs`` to ``17.4.0``. (`#3228 4146 <https://github.com/pytest-dev/pytest/issues/3228>`_) 4147 4148- Renamed example directories so all tests pass when ran from the base 4149 directory. (`#3245 <https://github.com/pytest-dev/pytest/issues/3245>`_) 4150 4151- Internal ``mark.py`` module has been turned into a package. (`#3250 4152 <https://github.com/pytest-dev/pytest/issues/3250>`_) 4153 4154- ``pytest`` now depends on the `more-itertools 4155 <https://github.com/erikrose/more-itertools>`_ package. (`#3265 4156 <https://github.com/pytest-dev/pytest/issues/3265>`_) 4157 4158- Added warning when ``[pytest]`` section is used in a ``.cfg`` file passed 4159 with ``-c`` (`#3268 <https://github.com/pytest-dev/pytest/issues/3268>`_) 4160 4161- ``nodeids`` can now be passed explicitly to ``FSCollector`` and ``Node`` 4162 constructors. (`#3291 <https://github.com/pytest-dev/pytest/issues/3291>`_) 4163 4164- Internal refactoring of ``FormattedExcinfo`` to use ``attrs`` facilities and 4165 remove old support code for legacy Python versions. (`#3292 4166 <https://github.com/pytest-dev/pytest/issues/3292>`_) 4167 4168- Refactoring to unify how verbosity is handled internally. (`#3296 4169 <https://github.com/pytest-dev/pytest/issues/3296>`_) 4170 4171- Internal refactoring to better integrate with argparse. (`#3304 4172 <https://github.com/pytest-dev/pytest/issues/3304>`_) 4173 4174- Fix a python example when calling a fixture in doc/en/usage.rst (`#3308 4175 <https://github.com/pytest-dev/pytest/issues/3308>`_) 4176 4177 4178pytest 3.4.2 (2018-03-04) 4179========================= 4180 4181Bug Fixes 4182--------- 4183 4184- Removed progress information when capture option is ``no``. (`#3203 4185 <https://github.com/pytest-dev/pytest/issues/3203>`_) 4186 4187- Refactor check of bindir from ``exists`` to ``isdir``. (`#3241 4188 <https://github.com/pytest-dev/pytest/issues/3241>`_) 4189 4190- Fix ``TypeError`` issue when using ``approx`` with a ``Decimal`` value. 4191 (`#3247 <https://github.com/pytest-dev/pytest/issues/3247>`_) 4192 4193- Fix reference cycle generated when using the ``request`` fixture. (`#3249 4194 <https://github.com/pytest-dev/pytest/issues/3249>`_) 4195 4196- ``[tool:pytest]`` sections in ``*.cfg`` files passed by the ``-c`` option are 4197 now properly recognized. (`#3260 4198 <https://github.com/pytest-dev/pytest/issues/3260>`_) 4199 4200 4201Improved Documentation 4202---------------------- 4203 4204- Add logging plugin to plugins list. (`#3209 4205 <https://github.com/pytest-dev/pytest/issues/3209>`_) 4206 4207 4208Trivial/Internal Changes 4209------------------------ 4210 4211- Fix minor typo in fixture.rst (`#3259 4212 <https://github.com/pytest-dev/pytest/issues/3259>`_) 4213 4214 4215pytest 3.4.1 (2018-02-20) 4216========================= 4217 4218Bug Fixes 4219--------- 4220 4221- Move import of ``doctest.UnexpectedException`` to top-level to avoid possible 4222 errors when using ``--pdb``. (`#1810 4223 <https://github.com/pytest-dev/pytest/issues/1810>`_) 4224 4225- Added printing of captured stdout/stderr before entering pdb, and improved a 4226 test which was giving false negatives about output capturing. (`#3052 4227 <https://github.com/pytest-dev/pytest/issues/3052>`_) 4228 4229- Fix ordering of tests using parametrized fixtures which can lead to fixtures 4230 being created more than necessary. (`#3161 4231 <https://github.com/pytest-dev/pytest/issues/3161>`_) 4232 4233- Fix bug where logging happening at hooks outside of "test run" hooks would 4234 cause an internal error. (`#3184 4235 <https://github.com/pytest-dev/pytest/issues/3184>`_) 4236 4237- Detect arguments injected by ``unittest.mock.patch`` decorator correctly when 4238 pypi ``mock.patch`` is installed and imported. (`#3206 4239 <https://github.com/pytest-dev/pytest/issues/3206>`_) 4240 4241- Errors shown when a ``pytest.raises()`` with ``match=`` fails are now cleaner 4242 on what happened: When no exception was raised, the "matching '...'" part got 4243 removed as it falsely implies that an exception was raised but it didn't 4244 match. When a wrong exception was raised, it's now thrown (like 4245 ``pytest.raised()`` without ``match=`` would) instead of complaining about 4246 the unmatched text. (`#3222 4247 <https://github.com/pytest-dev/pytest/issues/3222>`_) 4248 4249- Fixed output capture handling in doctests on macOS. (`#985 4250 <https://github.com/pytest-dev/pytest/issues/985>`_) 4251 4252 4253Improved Documentation 4254---------------------- 4255 4256- Add Sphinx parameter docs for ``match`` and ``message`` args to 4257 ``pytest.raises``. (`#3202 4258 <https://github.com/pytest-dev/pytest/issues/3202>`_) 4259 4260 4261Trivial/Internal Changes 4262------------------------ 4263 4264- pytest has changed the publication procedure and is now being published to 4265 PyPI directly from Travis. (`#3060 4266 <https://github.com/pytest-dev/pytest/issues/3060>`_) 4267 4268- Rename ``ParameterSet._for_parameterize()`` to ``_for_parametrize()`` in 4269 order to comply with the naming convention. (`#3166 4270 <https://github.com/pytest-dev/pytest/issues/3166>`_) 4271 4272- Skip failing pdb/doctest test on mac. (`#985 4273 <https://github.com/pytest-dev/pytest/issues/985>`_) 4274 4275 4276pytest 3.4.0 (2018-01-30) 4277========================= 4278 4279Deprecations and Removals 4280------------------------- 4281 4282- All pytest classes now subclass ``object`` for better Python 2/3 compatibility. 4283 This should not affect user code except in very rare edge cases. (`#2147 4284 <https://github.com/pytest-dev/pytest/issues/2147>`_) 4285 4286 4287Features 4288-------- 4289 4290- Introduce ``empty_parameter_set_mark`` ini option to select which mark to 4291 apply when ``@pytest.mark.parametrize`` is given an empty set of parameters. 4292 Valid options are ``skip`` (default) and ``xfail``. Note that it is planned 4293 to change the default to ``xfail`` in future releases as this is considered 4294 less error prone. (`#2527 4295 <https://github.com/pytest-dev/pytest/issues/2527>`_) 4296 4297- **Incompatible change**: after community feedback the `logging 4298 <https://docs.pytest.org/en/stable/logging.html>`_ functionality has 4299 undergone some changes. Please consult the `logging documentation 4300 <https://docs.pytest.org/en/stable/logging.html#incompatible-changes-in-pytest-3-4>`_ 4301 for details. (`#3013 <https://github.com/pytest-dev/pytest/issues/3013>`_) 4302 4303- Console output falls back to "classic" mode when capturing is disabled (``-s``), 4304 otherwise the output gets garbled to the point of being useless. (`#3038 4305 <https://github.com/pytest-dev/pytest/issues/3038>`_) 4306 4307- New `pytest_runtest_logfinish 4308 <https://docs.pytest.org/en/stable/reference.html#_pytest.hookspec.pytest_runtest_logfinish>`_ 4309 hook which is called when a test item has finished executing, analogous to 4310 `pytest_runtest_logstart 4311 <https://docs.pytest.org/en/stable/reference.html#_pytest.hookspec.pytest_runtest_logstart>`_. 4312 (`#3101 <https://github.com/pytest-dev/pytest/issues/3101>`_) 4313 4314- Improve performance when collecting tests using many fixtures. (`#3107 4315 <https://github.com/pytest-dev/pytest/issues/3107>`_) 4316 4317- New ``caplog.get_records(when)`` method which provides access to the captured 4318 records for the ``"setup"``, ``"call"`` and ``"teardown"`` 4319 testing stages. (`#3117 <https://github.com/pytest-dev/pytest/issues/3117>`_) 4320 4321- New fixture ``record_xml_attribute`` that allows modifying and inserting 4322 attributes on the ``<testcase>`` xml node in JUnit reports. (`#3130 4323 <https://github.com/pytest-dev/pytest/issues/3130>`_) 4324 4325- The default cache directory has been renamed from ``.cache`` to 4326 ``.pytest_cache`` after community feedback that the name ``.cache`` did not 4327 make it clear that it was used by pytest. (`#3138 4328 <https://github.com/pytest-dev/pytest/issues/3138>`_) 4329 4330- Colorize the levelname column in the live-log output. (`#3142 4331 <https://github.com/pytest-dev/pytest/issues/3142>`_) 4332 4333 4334Bug Fixes 4335--------- 4336 4337- Fix hanging pexpect test on MacOS by using flush() instead of wait(). 4338 (`#2022 <https://github.com/pytest-dev/pytest/issues/2022>`_) 4339 4340- Fix restoring Python state after in-process pytest runs with the 4341 ``pytester`` plugin; this may break tests using multiple inprocess 4342 pytest runs if later ones depend on earlier ones leaking global interpreter 4343 changes. (`#3016 <https://github.com/pytest-dev/pytest/issues/3016>`_) 4344 4345- Fix skipping plugin reporting hook when test aborted before plugin setup 4346 hook. (`#3074 <https://github.com/pytest-dev/pytest/issues/3074>`_) 4347 4348- Fix progress percentage reported when tests fail during teardown. (`#3088 4349 <https://github.com/pytest-dev/pytest/issues/3088>`_) 4350 4351- **Incompatible change**: ``-o/--override`` option no longer eats all the 4352 remaining options, which can lead to surprising behavior: for example, 4353 ``pytest -o foo=1 /path/to/test.py`` would fail because ``/path/to/test.py`` 4354 would be considered as part of the ``-o`` command-line argument. One 4355 consequence of this is that now multiple configuration overrides need 4356 multiple ``-o`` flags: ``pytest -o foo=1 -o bar=2``. (`#3103 4357 <https://github.com/pytest-dev/pytest/issues/3103>`_) 4358 4359 4360Improved Documentation 4361---------------------- 4362 4363- Document hooks (defined with ``historic=True``) which cannot be used with 4364 ``hookwrapper=True``. (`#2423 4365 <https://github.com/pytest-dev/pytest/issues/2423>`_) 4366 4367- Clarify that warning capturing doesn't change the warning filter by default. 4368 (`#2457 <https://github.com/pytest-dev/pytest/issues/2457>`_) 4369 4370- Clarify a possible confusion when using pytest_fixture_setup with fixture 4371 functions that return None. (`#2698 4372 <https://github.com/pytest-dev/pytest/issues/2698>`_) 4373 4374- Fix the wording of a sentence on doctest flags used in pytest. (`#3076 4375 <https://github.com/pytest-dev/pytest/issues/3076>`_) 4376 4377- Prefer ``https://*.readthedocs.io`` over ``http://*.rtfd.org`` for links in 4378 the documentation. (`#3092 4379 <https://github.com/pytest-dev/pytest/issues/3092>`_) 4380 4381- Improve readability (wording, grammar) of Getting Started guide (`#3131 4382 <https://github.com/pytest-dev/pytest/issues/3131>`_) 4383 4384- Added note that calling pytest.main multiple times from the same process is 4385 not recommended because of import caching. (`#3143 4386 <https://github.com/pytest-dev/pytest/issues/3143>`_) 4387 4388 4389Trivial/Internal Changes 4390------------------------ 4391 4392- Show a simple and easy error when keyword expressions trigger a syntax error 4393 (for example, ``"-k foo and import"`` will show an error that you can not use 4394 the ``import`` keyword in expressions). (`#2953 4395 <https://github.com/pytest-dev/pytest/issues/2953>`_) 4396 4397- Change parametrized automatic test id generation to use the ``__name__`` 4398 attribute of functions instead of the fallback argument name plus counter. 4399 (`#2976 <https://github.com/pytest-dev/pytest/issues/2976>`_) 4400 4401- Replace py.std with stdlib imports. (`#3067 4402 <https://github.com/pytest-dev/pytest/issues/3067>`_) 4403 4404- Corrected 'you' to 'your' in logging docs. (`#3129 4405 <https://github.com/pytest-dev/pytest/issues/3129>`_) 4406 4407 4408pytest 3.3.2 (2017-12-25) 4409========================= 4410 4411Bug Fixes 4412--------- 4413 4414- pytester: ignore files used to obtain current user metadata in the fd leak 4415 detector. (`#2784 <https://github.com/pytest-dev/pytest/issues/2784>`_) 4416 4417- Fix **memory leak** where objects returned by fixtures were never destructed 4418 by the garbage collector. (`#2981 4419 <https://github.com/pytest-dev/pytest/issues/2981>`_) 4420 4421- Fix conversion of pyargs to filename to not convert symlinks on Python 2. (`#2985 4422 <https://github.com/pytest-dev/pytest/issues/2985>`_) 4423 4424- ``PYTEST_DONT_REWRITE`` is now checked for plugins too rather than only for 4425 test modules. (`#2995 <https://github.com/pytest-dev/pytest/issues/2995>`_) 4426 4427 4428Improved Documentation 4429---------------------- 4430 4431- Add clarifying note about behavior of multiple parametrized arguments (`#3001 4432 <https://github.com/pytest-dev/pytest/issues/3001>`_) 4433 4434 4435Trivial/Internal Changes 4436------------------------ 4437 4438- Code cleanup. (`#3015 <https://github.com/pytest-dev/pytest/issues/3015>`_, 4439 `#3021 <https://github.com/pytest-dev/pytest/issues/3021>`_) 4440 4441- Clean up code by replacing imports and references of ``_ast`` to ``ast``. 4442 (`#3018 <https://github.com/pytest-dev/pytest/issues/3018>`_) 4443 4444 4445pytest 3.3.1 (2017-12-05) 4446========================= 4447 4448Bug Fixes 4449--------- 4450 4451- Fix issue about ``-p no:<plugin>`` having no effect. (`#2920 4452 <https://github.com/pytest-dev/pytest/issues/2920>`_) 4453 4454- Fix regression with warnings that contained non-strings in their arguments in 4455 Python 2. (`#2956 <https://github.com/pytest-dev/pytest/issues/2956>`_) 4456 4457- Always escape null bytes when setting ``PYTEST_CURRENT_TEST``. (`#2957 4458 <https://github.com/pytest-dev/pytest/issues/2957>`_) 4459 4460- Fix ``ZeroDivisionError`` when using the ``testmon`` plugin when no tests 4461 were actually collected. (`#2971 4462 <https://github.com/pytest-dev/pytest/issues/2971>`_) 4463 4464- Bring back ``TerminalReporter.writer`` as an alias to 4465 ``TerminalReporter._tw``. This alias was removed by accident in the ``3.3.0`` 4466 release. (`#2984 <https://github.com/pytest-dev/pytest/issues/2984>`_) 4467 4468- The ``pytest-capturelog`` plugin is now also blacklisted, avoiding errors when 4469 running pytest with it still installed. (`#3004 4470 <https://github.com/pytest-dev/pytest/issues/3004>`_) 4471 4472 4473Improved Documentation 4474---------------------- 4475 4476- Fix broken link to plugin ``pytest-localserver``. (`#2963 4477 <https://github.com/pytest-dev/pytest/issues/2963>`_) 4478 4479 4480Trivial/Internal Changes 4481------------------------ 4482 4483- Update github "bugs" link in ``CONTRIBUTING.rst`` (`#2949 4484 <https://github.com/pytest-dev/pytest/issues/2949>`_) 4485 4486 4487pytest 3.3.0 (2017-11-23) 4488========================= 4489 4490Deprecations and Removals 4491------------------------- 4492 4493- pytest no longer supports Python **2.6** and **3.3**. Those Python versions 4494 are EOL for some time now and incur maintenance and compatibility costs on 4495 the pytest core team, and following up with the rest of the community we 4496 decided that they will no longer be supported starting on this version. Users 4497 which still require those versions should pin pytest to ``<3.3``. (`#2812 4498 <https://github.com/pytest-dev/pytest/issues/2812>`_) 4499 4500- Remove internal ``_preloadplugins()`` function. This removal is part of the 4501 ``pytest_namespace()`` hook deprecation. (`#2636 4502 <https://github.com/pytest-dev/pytest/issues/2636>`_) 4503 4504- Internally change ``CallSpec2`` to have a list of marks instead of a broken 4505 mapping of keywords. This removes the keywords attribute of the internal 4506 ``CallSpec2`` class. (`#2672 4507 <https://github.com/pytest-dev/pytest/issues/2672>`_) 4508 4509- Remove ParameterSet.deprecated_arg_dict - its not a public api and the lack 4510 of the underscore was a naming error. (`#2675 4511 <https://github.com/pytest-dev/pytest/issues/2675>`_) 4512 4513- Remove the internal multi-typed attribute ``Node._evalskip`` and replace it 4514 with the boolean ``Node._skipped_by_mark``. (`#2767 4515 <https://github.com/pytest-dev/pytest/issues/2767>`_) 4516 4517- The ``params`` list passed to ``pytest.fixture`` is now for 4518 all effects considered immutable and frozen at the moment of the ``pytest.fixture`` 4519 call. Previously the list could be changed before the first invocation of the fixture 4520 allowing for a form of dynamic parametrization (for example, updated from command-line options), 4521 but this was an unwanted implementation detail which complicated the internals and prevented 4522 some internal cleanup. See issue `#2959 <https://github.com/pytest-dev/pytest/issues/2959>`_ 4523 for details and a recommended workaround. 4524 4525Features 4526-------- 4527 4528- ``pytest_fixture_post_finalizer`` hook can now receive a ``request`` 4529 argument. (`#2124 <https://github.com/pytest-dev/pytest/issues/2124>`_) 4530 4531- Replace the old introspection code in compat.py that determines the available 4532 arguments of fixtures with inspect.signature on Python 3 and 4533 funcsigs.signature on Python 2. This should respect ``__signature__`` 4534 declarations on functions. (`#2267 4535 <https://github.com/pytest-dev/pytest/issues/2267>`_) 4536 4537- Report tests with global ``pytestmark`` variable only once. (`#2549 4538 <https://github.com/pytest-dev/pytest/issues/2549>`_) 4539 4540- Now pytest displays the total progress percentage while running tests. The 4541 previous output style can be set by configuring the ``console_output_style`` 4542 setting to ``classic``. (`#2657 <https://github.com/pytest-dev/pytest/issues/2657>`_) 4543 4544- Match ``warns`` signature to ``raises`` by adding ``match`` keyword. (`#2708 4545 <https://github.com/pytest-dev/pytest/issues/2708>`_) 4546 4547- pytest now captures and displays output from the standard ``logging`` module. 4548 The user can control the logging level to be captured by specifying options 4549 in ``pytest.ini``, the command line and also during individual tests using 4550 markers. Also, a ``caplog`` fixture is available that enables users to test 4551 the captured log during specific tests (similar to ``capsys`` for example). 4552 For more information, please see the `logging docs 4553 <https://docs.pytest.org/en/stable/logging.html>`_. This feature was 4554 introduced by merging the popular `pytest-catchlog 4555 <https://pypi.org/project/pytest-catchlog/>`_ plugin, thanks to `Thomas Hisch 4556 <https://github.com/thisch>`_. Be advised that during the merging the 4557 backward compatibility interface with the defunct ``pytest-capturelog`` has 4558 been dropped. (`#2794 <https://github.com/pytest-dev/pytest/issues/2794>`_) 4559 4560- Add ``allow_module_level`` kwarg to ``pytest.skip()``, enabling to skip the 4561 whole module. (`#2808 <https://github.com/pytest-dev/pytest/issues/2808>`_) 4562 4563- Allow setting ``file_or_dir``, ``-c``, and ``-o`` in PYTEST_ADDOPTS. (`#2824 4564 <https://github.com/pytest-dev/pytest/issues/2824>`_) 4565 4566- Return stdout/stderr capture results as a ``namedtuple``, so ``out`` and 4567 ``err`` can be accessed by attribute. (`#2879 4568 <https://github.com/pytest-dev/pytest/issues/2879>`_) 4569 4570- Add ``capfdbinary``, a version of ``capfd`` which returns bytes from 4571 ``readouterr()``. (`#2923 4572 <https://github.com/pytest-dev/pytest/issues/2923>`_) 4573 4574- Add ``capsysbinary`` a version of ``capsys`` which returns bytes from 4575 ``readouterr()``. (`#2934 4576 <https://github.com/pytest-dev/pytest/issues/2934>`_) 4577 4578- Implement feature to skip ``setup.py`` files when run with 4579 ``--doctest-modules``. (`#502 4580 <https://github.com/pytest-dev/pytest/issues/502>`_) 4581 4582 4583Bug Fixes 4584--------- 4585 4586- Resume output capturing after ``capsys/capfd.disabled()`` context manager. 4587 (`#1993 <https://github.com/pytest-dev/pytest/issues/1993>`_) 4588 4589- ``pytest_fixture_setup`` and ``pytest_fixture_post_finalizer`` hooks are now 4590 called for all ``conftest.py`` files. (`#2124 4591 <https://github.com/pytest-dev/pytest/issues/2124>`_) 4592 4593- If an exception happens while loading a plugin, pytest no longer hides the 4594 original traceback. In Python 2 it will show the original traceback with a new 4595 message that explains in which plugin. In Python 3 it will show 2 canonized 4596 exceptions, the original exception while loading the plugin in addition to an 4597 exception that pytest throws about loading a plugin. (`#2491 4598 <https://github.com/pytest-dev/pytest/issues/2491>`_) 4599 4600- ``capsys`` and ``capfd`` can now be used by other fixtures. (`#2709 4601 <https://github.com/pytest-dev/pytest/issues/2709>`_) 4602 4603- Internal ``pytester`` plugin properly encodes ``bytes`` arguments to 4604 ``utf-8``. (`#2738 <https://github.com/pytest-dev/pytest/issues/2738>`_) 4605 4606- ``testdir`` now uses use the same method used by ``tmpdir`` to create its 4607 temporary directory. This changes the final structure of the ``testdir`` 4608 directory slightly, but should not affect usage in normal scenarios and 4609 avoids a number of potential problems. (`#2751 4610 <https://github.com/pytest-dev/pytest/issues/2751>`_) 4611 4612- pytest no longer complains about warnings with unicode messages being 4613 non-ascii compatible even for ascii-compatible messages. As a result of this, 4614 warnings with unicode messages are converted first to an ascii representation 4615 for safety. (`#2809 <https://github.com/pytest-dev/pytest/issues/2809>`_) 4616 4617- Change return value of pytest command when ``--maxfail`` is reached from 4618 ``2`` (interrupted) to ``1`` (failed). (`#2845 4619 <https://github.com/pytest-dev/pytest/issues/2845>`_) 4620 4621- Fix issue in assertion rewriting which could lead it to rewrite modules which 4622 should not be rewritten. (`#2939 4623 <https://github.com/pytest-dev/pytest/issues/2939>`_) 4624 4625- Handle marks without description in ``pytest.ini``. (`#2942 4626 <https://github.com/pytest-dev/pytest/issues/2942>`_) 4627 4628 4629Trivial/Internal Changes 4630------------------------ 4631 4632- pytest now depends on `attrs <https://pypi.org/project/attrs/>`__ for internal 4633 structures to ease code maintainability. (`#2641 4634 <https://github.com/pytest-dev/pytest/issues/2641>`_) 4635 4636- Refactored internal Python 2/3 compatibility code to use ``six``. (`#2642 4637 <https://github.com/pytest-dev/pytest/issues/2642>`_) 4638 4639- Stop vendoring ``pluggy`` - we're missing out on its latest changes for not 4640 much benefit (`#2719 <https://github.com/pytest-dev/pytest/issues/2719>`_) 4641 4642- Internal refactor: simplify ascii string escaping by using the 4643 backslashreplace error handler in newer Python 3 versions. (`#2734 4644 <https://github.com/pytest-dev/pytest/issues/2734>`_) 4645 4646- Remove unnecessary mark evaluator in unittest plugin (`#2767 4647 <https://github.com/pytest-dev/pytest/issues/2767>`_) 4648 4649- Calls to ``Metafunc.addcall`` now emit a deprecation warning. This function 4650 is scheduled to be removed in ``pytest-4.0``. (`#2876 4651 <https://github.com/pytest-dev/pytest/issues/2876>`_) 4652 4653- Internal move of the parameterset extraction to a more maintainable place. 4654 (`#2877 <https://github.com/pytest-dev/pytest/issues/2877>`_) 4655 4656- Internal refactoring to simplify scope node lookup. (`#2910 4657 <https://github.com/pytest-dev/pytest/issues/2910>`_) 4658 4659- Configure ``pytest`` to prevent pip from installing pytest in unsupported 4660 Python versions. (`#2922 4661 <https://github.com/pytest-dev/pytest/issues/2922>`_) 4662 4663 4664pytest 3.2.5 (2017-11-15) 4665========================= 4666 4667Bug Fixes 4668--------- 4669 4670- Remove ``py<1.5`` restriction from ``pytest`` as this can cause version 4671 conflicts in some installations. (`#2926 4672 <https://github.com/pytest-dev/pytest/issues/2926>`_) 4673 4674 4675pytest 3.2.4 (2017-11-13) 4676========================= 4677 4678Bug Fixes 4679--------- 4680 4681- Fix the bug where running with ``--pyargs`` will result in items with 4682 empty ``parent.nodeid`` if run from a different root directory. (`#2775 4683 <https://github.com/pytest-dev/pytest/issues/2775>`_) 4684 4685- Fix issue with ``@pytest.parametrize`` if argnames was specified as keyword arguments. 4686 (`#2819 <https://github.com/pytest-dev/pytest/issues/2819>`_) 4687 4688- Strip whitespace from marker names when reading them from INI config. (`#2856 4689 <https://github.com/pytest-dev/pytest/issues/2856>`_) 4690 4691- Show full context of doctest source in the pytest output, if the line number of 4692 failed example in the docstring is < 9. (`#2882 4693 <https://github.com/pytest-dev/pytest/issues/2882>`_) 4694 4695- Match fixture paths against actual path segments in order to avoid matching folders which share a prefix. 4696 (`#2836 <https://github.com/pytest-dev/pytest/issues/2836>`_) 4697 4698Improved Documentation 4699---------------------- 4700 4701- Introduce a dedicated section about conftest.py. (`#1505 4702 <https://github.com/pytest-dev/pytest/issues/1505>`_) 4703 4704- Explicitly mention ``xpass`` in the documentation of ``xfail``. (`#1997 4705 <https://github.com/pytest-dev/pytest/issues/1997>`_) 4706 4707- Append example for pytest.param in the example/parametrize document. (`#2658 4708 <https://github.com/pytest-dev/pytest/issues/2658>`_) 4709 4710- Clarify language of proposal for fixtures parameters (`#2893 4711 <https://github.com/pytest-dev/pytest/issues/2893>`_) 4712 4713- List python 3.6 in the documented supported versions in the getting started 4714 document. (`#2903 <https://github.com/pytest-dev/pytest/issues/2903>`_) 4715 4716- Clarify the documentation of available fixture scopes. (`#538 4717 <https://github.com/pytest-dev/pytest/issues/538>`_) 4718 4719- Add documentation about the ``python -m pytest`` invocation adding the 4720 current directory to sys.path. (`#911 4721 <https://github.com/pytest-dev/pytest/issues/911>`_) 4722 4723 4724pytest 3.2.3 (2017-10-03) 4725========================= 4726 4727Bug Fixes 4728--------- 4729 4730- Fix crash in tab completion when no prefix is given. (`#2748 4731 <https://github.com/pytest-dev/pytest/issues/2748>`_) 4732 4733- The equality checking function (``__eq__``) of ``MarkDecorator`` returns 4734 ``False`` if one object is not an instance of ``MarkDecorator``. (`#2758 4735 <https://github.com/pytest-dev/pytest/issues/2758>`_) 4736 4737- When running ``pytest --fixtures-per-test``: don't crash if an item has no 4738 _fixtureinfo attribute (e.g. doctests) (`#2788 4739 <https://github.com/pytest-dev/pytest/issues/2788>`_) 4740 4741 4742Improved Documentation 4743---------------------- 4744 4745- In help text of ``-k`` option, add example of using ``not`` to not select 4746 certain tests whose names match the provided expression. (`#1442 4747 <https://github.com/pytest-dev/pytest/issues/1442>`_) 4748 4749- Add note in ``parametrize.rst`` about calling ``metafunc.parametrize`` 4750 multiple times. (`#1548 <https://github.com/pytest-dev/pytest/issues/1548>`_) 4751 4752 4753Trivial/Internal Changes 4754------------------------ 4755 4756- Set ``xfail_strict=True`` in pytest's own test suite to catch expected 4757 failures as soon as they start to pass. (`#2722 4758 <https://github.com/pytest-dev/pytest/issues/2722>`_) 4759 4760- Fix typo in example of passing a callable to markers (in example/markers.rst) 4761 (`#2765 <https://github.com/pytest-dev/pytest/issues/2765>`_) 4762 4763 4764pytest 3.2.2 (2017-09-06) 4765========================= 4766 4767Bug Fixes 4768--------- 4769 4770- Calling the deprecated ``request.getfuncargvalue()`` now shows the source of 4771 the call. (`#2681 <https://github.com/pytest-dev/pytest/issues/2681>`_) 4772 4773- Allow tests declared as ``@staticmethod`` to use fixtures. (`#2699 4774 <https://github.com/pytest-dev/pytest/issues/2699>`_) 4775 4776- Fixed edge-case during collection: attributes which raised ``pytest.fail`` 4777 when accessed would abort the entire collection. (`#2707 4778 <https://github.com/pytest-dev/pytest/issues/2707>`_) 4779 4780- Fix ``ReprFuncArgs`` with mixed unicode and UTF-8 args. (`#2731 4781 <https://github.com/pytest-dev/pytest/issues/2731>`_) 4782 4783 4784Improved Documentation 4785---------------------- 4786 4787- In examples on working with custom markers, add examples demonstrating the 4788 usage of ``pytest.mark.MARKER_NAME.with_args`` in comparison with 4789 ``pytest.mark.MARKER_NAME.__call__`` (`#2604 4790 <https://github.com/pytest-dev/pytest/issues/2604>`_) 4791 4792- In one of the simple examples, use ``pytest_collection_modifyitems()`` to skip 4793 tests based on a command-line option, allowing its sharing while preventing a 4794 user error when acessing ``pytest.config`` before the argument parsing. 4795 (`#2653 <https://github.com/pytest-dev/pytest/issues/2653>`_) 4796 4797 4798Trivial/Internal Changes 4799------------------------ 4800 4801- Fixed minor error in 'Good Practices/Manual Integration' code snippet. 4802 (`#2691 <https://github.com/pytest-dev/pytest/issues/2691>`_) 4803 4804- Fixed typo in goodpractices.rst. (`#2721 4805 <https://github.com/pytest-dev/pytest/issues/2721>`_) 4806 4807- Improve user guidance regarding ``--resultlog`` deprecation. (`#2739 4808 <https://github.com/pytest-dev/pytest/issues/2739>`_) 4809 4810 4811pytest 3.2.1 (2017-08-08) 4812========================= 4813 4814Bug Fixes 4815--------- 4816 4817- Fixed small terminal glitch when collecting a single test item. (`#2579 4818 <https://github.com/pytest-dev/pytest/issues/2579>`_) 4819 4820- Correctly consider ``/`` as the file separator to automatically mark plugin 4821 files for rewrite on Windows. (`#2591 <https://github.com/pytest- 4822 dev/pytest/issues/2591>`_) 4823 4824- Properly escape test names when setting ``PYTEST_CURRENT_TEST`` environment 4825 variable. (`#2644 <https://github.com/pytest-dev/pytest/issues/2644>`_) 4826 4827- Fix error on Windows and Python 3.6+ when ``sys.stdout`` has been replaced 4828 with a stream-like object which does not implement the full ``io`` module 4829 buffer protocol. In particular this affects ``pytest-xdist`` users on the 4830 aforementioned platform. (`#2666 <https://github.com/pytest- 4831 dev/pytest/issues/2666>`_) 4832 4833 4834Improved Documentation 4835---------------------- 4836 4837- Explicitly document which pytest features work with ``unittest``. (`#2626 4838 <https://github.com/pytest-dev/pytest/issues/2626>`_) 4839 4840 4841pytest 3.2.0 (2017-07-30) 4842========================= 4843 4844Deprecations and Removals 4845------------------------- 4846 4847- ``pytest.approx`` no longer supports ``>``, ``>=``, ``<`` and ``<=`` 4848 operators to avoid surprising/inconsistent behavior. See `the approx docs 4849 <https://docs.pytest.org/en/stable/reference.html#pytest-approx>`_ for more 4850 information. (`#2003 <https://github.com/pytest-dev/pytest/issues/2003>`_) 4851 4852- All old-style specific behavior in current classes in the pytest's API is 4853 considered deprecated at this point and will be removed in a future release. 4854 This affects Python 2 users only and in rare situations. (`#2147 4855 <https://github.com/pytest-dev/pytest/issues/2147>`_) 4856 4857- A deprecation warning is now raised when using marks for parameters 4858 in ``pytest.mark.parametrize``. Use ``pytest.param`` to apply marks to 4859 parameters instead. (`#2427 <https://github.com/pytest-dev/pytest/issues/2427>`_) 4860 4861 4862Features 4863-------- 4864 4865- Add support for numpy arrays (and dicts) to approx. (`#1994 4866 <https://github.com/pytest-dev/pytest/issues/1994>`_) 4867 4868- Now test function objects have a ``pytestmark`` attribute containing a list 4869 of marks applied directly to the test function, as opposed to marks inherited 4870 from parent classes or modules. (`#2516 <https://github.com/pytest- 4871 dev/pytest/issues/2516>`_) 4872 4873- Collection ignores local virtualenvs by default; ``--collect-in-virtualenv`` 4874 overrides this behavior. (`#2518 <https://github.com/pytest- 4875 dev/pytest/issues/2518>`_) 4876 4877- Allow class methods decorated as ``@staticmethod`` to be candidates for 4878 collection as a test function. (Only for Python 2.7 and above. Python 2.6 4879 will still ignore static methods.) (`#2528 <https://github.com/pytest- 4880 dev/pytest/issues/2528>`_) 4881 4882- Introduce ``mark.with_args`` in order to allow passing functions/classes as 4883 sole argument to marks. (`#2540 <https://github.com/pytest- 4884 dev/pytest/issues/2540>`_) 4885 4886- New ``cache_dir`` ini option: sets the directory where the contents of the 4887 cache plugin are stored. Directory may be relative or absolute path: if relative path, then 4888 directory is created relative to ``rootdir``, otherwise it is used as is. 4889 Additionally path may contain environment variables which are expanded during 4890 runtime. (`#2543 <https://github.com/pytest-dev/pytest/issues/2543>`_) 4891 4892- Introduce the ``PYTEST_CURRENT_TEST`` environment variable that is set with 4893 the ``nodeid`` and stage (``setup``, ``call`` and ``teardown``) of the test 4894 being currently executed. See the `documentation 4895 <https://docs.pytest.org/en/stable/example/simple.html#pytest-current-test- 4896 environment-variable>`_ for more info. (`#2583 <https://github.com/pytest- 4897 dev/pytest/issues/2583>`_) 4898 4899- Introduced ``@pytest.mark.filterwarnings`` mark which allows overwriting the 4900 warnings filter on a per test, class or module level. See the `docs 4901 <https://docs.pytest.org/en/stable/warnings.html#pytest-mark- 4902 filterwarnings>`_ for more information. (`#2598 <https://github.com/pytest- 4903 dev/pytest/issues/2598>`_) 4904 4905- ``--last-failed`` now remembers forever when a test has failed and only 4906 forgets it if it passes again. This makes it easy to fix a test suite by 4907 selectively running files and fixing tests incrementally. (`#2621 4908 <https://github.com/pytest-dev/pytest/issues/2621>`_) 4909 4910- New ``pytest_report_collectionfinish`` hook which allows plugins to add 4911 messages to the terminal reporting after collection has been finished 4912 successfully. (`#2622 <https://github.com/pytest-dev/pytest/issues/2622>`_) 4913 4914- Added support for `PEP-415's <https://www.python.org/dev/peps/pep-0415/>`_ 4915 ``Exception.__suppress_context__``. Now if a ``raise exception from None`` is 4916 caught by pytest, pytest will no longer chain the context in the test report. 4917 The behavior now matches Python's traceback behavior. (`#2631 4918 <https://github.com/pytest-dev/pytest/issues/2631>`_) 4919 4920- Exceptions raised by ``pytest.fail``, ``pytest.skip`` and ``pytest.xfail`` 4921 now subclass BaseException, making them harder to be caught unintentionally 4922 by normal code. (`#580 <https://github.com/pytest-dev/pytest/issues/580>`_) 4923 4924 4925Bug Fixes 4926--------- 4927 4928- Set ``stdin`` to a closed ``PIPE`` in ``pytester.py.Testdir.popen()`` for 4929 avoid unwanted interactive ``pdb`` (`#2023 <https://github.com/pytest- 4930 dev/pytest/issues/2023>`_) 4931 4932- Add missing ``encoding`` attribute to ``sys.std*`` streams when using 4933 ``capsys`` capture mode. (`#2375 <https://github.com/pytest- 4934 dev/pytest/issues/2375>`_) 4935 4936- Fix terminal color changing to black on Windows if ``colorama`` is imported 4937 in a ``conftest.py`` file. (`#2510 <https://github.com/pytest- 4938 dev/pytest/issues/2510>`_) 4939 4940- Fix line number when reporting summary of skipped tests. (`#2548 4941 <https://github.com/pytest-dev/pytest/issues/2548>`_) 4942 4943- capture: ensure that EncodedFile.name is a string. (`#2555 4944 <https://github.com/pytest-dev/pytest/issues/2555>`_) 4945 4946- The options ``--fixtures`` and ``--fixtures-per-test`` will now keep 4947 indentation within docstrings. (`#2574 <https://github.com/pytest- 4948 dev/pytest/issues/2574>`_) 4949 4950- doctests line numbers are now reported correctly, fixing `pytest-sugar#122 4951 <https://github.com/Frozenball/pytest-sugar/issues/122>`_. (`#2610 4952 <https://github.com/pytest-dev/pytest/issues/2610>`_) 4953 4954- Fix non-determinism in order of fixture collection. Adds new dependency 4955 (ordereddict) for Python 2.6. (`#920 <https://github.com/pytest- 4956 dev/pytest/issues/920>`_) 4957 4958 4959Improved Documentation 4960---------------------- 4961 4962- Clarify ``pytest_configure`` hook call order. (`#2539 4963 <https://github.com/pytest-dev/pytest/issues/2539>`_) 4964 4965- Extend documentation for testing plugin code with the ``pytester`` plugin. 4966 (`#971 <https://github.com/pytest-dev/pytest/issues/971>`_) 4967 4968 4969Trivial/Internal Changes 4970------------------------ 4971 4972- Update help message for ``--strict`` to make it clear it only deals with 4973 unregistered markers, not warnings. (`#2444 <https://github.com/pytest- 4974 dev/pytest/issues/2444>`_) 4975 4976- Internal code move: move code for pytest.approx/pytest.raises to own files in 4977 order to cut down the size of python.py (`#2489 <https://github.com/pytest- 4978 dev/pytest/issues/2489>`_) 4979 4980- Renamed the utility function ``_pytest.compat._escape_strings`` to 4981 ``_ascii_escaped`` to better communicate the function's purpose. (`#2533 4982 <https://github.com/pytest-dev/pytest/issues/2533>`_) 4983 4984- Improve error message for CollectError with skip/skipif. (`#2546 4985 <https://github.com/pytest-dev/pytest/issues/2546>`_) 4986 4987- Emit warning about ``yield`` tests being deprecated only once per generator. 4988 (`#2562 <https://github.com/pytest-dev/pytest/issues/2562>`_) 4989 4990- Ensure final collected line doesn't include artifacts of previous write. 4991 (`#2571 <https://github.com/pytest-dev/pytest/issues/2571>`_) 4992 4993- Fixed all flake8 errors and warnings. (`#2581 <https://github.com/pytest- 4994 dev/pytest/issues/2581>`_) 4995 4996- Added ``fix-lint`` tox environment to run automatic pep8 fixes on the code. 4997 (`#2582 <https://github.com/pytest-dev/pytest/issues/2582>`_) 4998 4999- Turn warnings into errors in pytest's own test suite in order to catch 5000 regressions due to deprecations more promptly. (`#2588 5001 <https://github.com/pytest-dev/pytest/issues/2588>`_) 5002 5003- Show multiple issue links in CHANGELOG entries. (`#2620 5004 <https://github.com/pytest-dev/pytest/issues/2620>`_) 5005 5006 5007pytest 3.1.3 (2017-07-03) 5008========================= 5009 5010Bug Fixes 5011--------- 5012 5013- Fix decode error in Python 2 for doctests in docstrings. (`#2434 5014 <https://github.com/pytest-dev/pytest/issues/2434>`_) 5015 5016- Exceptions raised during teardown by finalizers are now suppressed until all 5017 finalizers are called, with the initial exception reraised. (`#2440 5018 <https://github.com/pytest-dev/pytest/issues/2440>`_) 5019 5020- Fix incorrect "collected items" report when specifying tests on the command- 5021 line. (`#2464 <https://github.com/pytest-dev/pytest/issues/2464>`_) 5022 5023- ``deprecated_call`` in context-manager form now captures deprecation warnings 5024 even if the same warning has already been raised. Also, ``deprecated_call`` 5025 will always produce the same error message (previously it would produce 5026 different messages in context-manager vs. function-call mode). (`#2469 5027 <https://github.com/pytest-dev/pytest/issues/2469>`_) 5028 5029- Fix issue where paths collected by pytest could have triple leading ``/`` 5030 characters. (`#2475 <https://github.com/pytest-dev/pytest/issues/2475>`_) 5031 5032- Fix internal error when trying to detect the start of a recursive traceback. 5033 (`#2486 <https://github.com/pytest-dev/pytest/issues/2486>`_) 5034 5035 5036Improved Documentation 5037---------------------- 5038 5039- Explicitly state for which hooks the calls stop after the first non-None 5040 result. (`#2493 <https://github.com/pytest-dev/pytest/issues/2493>`_) 5041 5042 5043Trivial/Internal Changes 5044------------------------ 5045 5046- Create invoke tasks for updating the vendored packages. (`#2474 5047 <https://github.com/pytest-dev/pytest/issues/2474>`_) 5048 5049- Update copyright dates in LICENSE, README.rst and in the documentation. 5050 (`#2499 <https://github.com/pytest-dev/pytest/issues/2499>`_) 5051 5052 5053pytest 3.1.2 (2017-06-08) 5054========================= 5055 5056Bug Fixes 5057--------- 5058 5059- Required options added via ``pytest_addoption`` will no longer prevent using 5060 --help without passing them. (#1999) 5061 5062- Respect ``python_files`` in assertion rewriting. (#2121) 5063 5064- Fix recursion error detection when frames in the traceback contain objects 5065 that can't be compared (like ``numpy`` arrays). (#2459) 5066 5067- ``UnicodeWarning`` is issued from the internal pytest warnings plugin only 5068 when the message contains non-ascii unicode (Python 2 only). (#2463) 5069 5070- Added a workaround for Python 3.6 ``WindowsConsoleIO`` breaking due to Pytests's 5071 ``FDCapture``. Other code using console handles might still be affected by the 5072 very same issue and might require further workarounds/fixes, i.e. ``colorama``. 5073 (#2467) 5074 5075 5076Improved Documentation 5077---------------------- 5078 5079- Fix internal API links to ``pluggy`` objects. (#2331) 5080 5081- Make it clear that ``pytest.xfail`` stops test execution at the calling point 5082 and improve overall flow of the ``skipping`` docs. (#810) 5083 5084 5085pytest 3.1.1 (2017-05-30) 5086========================= 5087 5088Bug Fixes 5089--------- 5090 5091- pytest warning capture no longer overrides existing warning filters. The 5092 previous behaviour would override all filters and caused regressions in test 5093 suites which configure warning filters to match their needs. Note that as a 5094 side-effect of this is that ``DeprecationWarning`` and 5095 ``PendingDeprecationWarning`` are no longer shown by default. (#2430) 5096 5097- Fix issue with non-ascii contents in doctest text files. (#2434) 5098 5099- Fix encoding errors for unicode warnings in Python 2. (#2436) 5100 5101- ``pytest.deprecated_call`` now captures ``PendingDeprecationWarning`` in 5102 context manager form. (#2441) 5103 5104 5105Improved Documentation 5106---------------------- 5107 5108- Addition of towncrier for changelog management. (#2390) 5109 5110 51113.1.0 (2017-05-22) 5112================== 5113 5114 5115New Features 5116------------ 5117 5118* The ``pytest-warnings`` plugin has been integrated into the core and now ``pytest`` automatically 5119 captures and displays warnings at the end of the test session. 5120 5121 .. warning:: 5122 5123 This feature may disrupt test suites which apply and treat warnings themselves, and can be 5124 disabled in your ``pytest.ini``: 5125 5126 .. code-block:: ini 5127 5128 [pytest] 5129 addopts = -p no:warnings 5130 5131 See the `warnings documentation page <https://docs.pytest.org/en/stable/warnings.html>`_ for more 5132 information. 5133 5134 Thanks `@nicoddemus`_ for the PR. 5135 5136* Added ``junit_suite_name`` ini option to specify root ``<testsuite>`` name for JUnit XML reports (`#533`_). 5137 5138* Added an ini option ``doctest_encoding`` to specify which encoding to use for doctest files. 5139 Thanks `@wheerd`_ for the PR (`#2101`_). 5140 5141* ``pytest.warns`` now checks for subclass relationship rather than 5142 class equality. Thanks `@lesteve`_ for the PR (`#2166`_) 5143 5144* ``pytest.raises`` now asserts that the error message matches a text or regex 5145 with the ``match`` keyword argument. Thanks `@Kriechi`_ for the PR. 5146 5147* ``pytest.param`` can be used to declare test parameter sets with marks and test ids. 5148 Thanks `@RonnyPfannschmidt`_ for the PR. 5149 5150 5151Changes 5152------- 5153 5154* remove all internal uses of pytest_namespace hooks, 5155 this is to prepare the removal of preloadconfig in pytest 4.0 5156 Thanks to `@RonnyPfannschmidt`_ for the PR. 5157 5158* pytest now warns when a callable ids raises in a parametrized test. Thanks `@fogo`_ for the PR. 5159 5160* It is now possible to skip test classes from being collected by setting a 5161 ``__test__`` attribute to ``False`` in the class body (`#2007`_). Thanks 5162 to `@syre`_ for the report and `@lwm`_ for the PR. 5163 5164* Change junitxml.py to produce reports that comply with Junitxml schema. 5165 If the same test fails with failure in call and then errors in teardown 5166 we split testcase element into two, one containing the error and the other 5167 the failure. (`#2228`_) Thanks to `@kkoukiou`_ for the PR. 5168 5169* Testcase reports with a ``url`` attribute will now properly write this to junitxml. 5170 Thanks `@fushi`_ for the PR (`#1874`_). 5171 5172* Remove common items from dict comparison output when verbosity=1. Also update 5173 the truncation message to make it clearer that pytest truncates all 5174 assertion messages if verbosity < 2 (`#1512`_). 5175 Thanks `@mattduck`_ for the PR 5176 5177* ``--pdbcls`` no longer implies ``--pdb``. This makes it possible to use 5178 ``addopts=--pdbcls=module.SomeClass`` on ``pytest.ini``. Thanks `@davidszotten`_ for 5179 the PR (`#1952`_). 5180 5181* fix `#2013`_: turn RecordedWarning into ``namedtuple``, 5182 to give it a comprehensible repr while preventing unwarranted modification. 5183 5184* fix `#2208`_: ensure an iteration limit for _pytest.compat.get_real_func. 5185 Thanks `@RonnyPfannschmidt`_ for the report and PR. 5186 5187* Hooks are now verified after collection is complete, rather than right after loading installed plugins. This 5188 makes it easy to write hooks for plugins which will be loaded during collection, for example using the 5189 ``pytest_plugins`` special variable (`#1821`_). 5190 Thanks `@nicoddemus`_ for the PR. 5191 5192* Modify ``pytest_make_parametrize_id()`` hook to accept ``argname`` as an 5193 additional parameter. 5194 Thanks `@unsignedint`_ for the PR. 5195 5196* Add ``venv`` to the default ``norecursedirs`` setting. 5197 Thanks `@The-Compiler`_ for the PR. 5198 5199* ``PluginManager.import_plugin`` now accepts unicode plugin names in Python 2. 5200 Thanks `@reutsharabani`_ for the PR. 5201 5202* fix `#2308`_: When using both ``--lf`` and ``--ff``, only the last failed tests are run. 5203 Thanks `@ojii`_ for the PR. 5204 5205* Replace minor/patch level version numbers in the documentation with placeholders. 5206 This significantly reduces change-noise as different contributors regnerate 5207 the documentation on different platforms. 5208 Thanks `@RonnyPfannschmidt`_ for the PR. 5209 5210* fix `#2391`_: consider pytest_plugins on all plugin modules 5211 Thanks `@RonnyPfannschmidt`_ for the PR. 5212 5213 5214Bug Fixes 5215--------- 5216 5217* Fix ``AttributeError`` on ``sys.stdout.buffer`` / ``sys.stderr.buffer`` 5218 while using ``capsys`` fixture in python 3. (`#1407`_). 5219 Thanks to `@asottile`_. 5220 5221* Change capture.py's ``DontReadFromInput`` class to throw ``io.UnsupportedOperation`` errors rather 5222 than ValueErrors in the ``fileno`` method (`#2276`_). 5223 Thanks `@metasyn`_ and `@vlad-dragos`_ for the PR. 5224 5225* Fix exception formatting while importing modules when the exception message 5226 contains non-ascii characters (`#2336`_). 5227 Thanks `@fabioz`_ for the report and `@nicoddemus`_ for the PR. 5228 5229* Added documentation related to issue (`#1937`_) 5230 Thanks `@skylarjhdownes`_ for the PR. 5231 5232* Allow collecting files with any file extension as Python modules (`#2369`_). 5233 Thanks `@Kodiologist`_ for the PR. 5234 5235* Show the correct error message when collect "parametrize" func with wrong args (`#2383`_). 5236 Thanks `@The-Compiler`_ for the report and `@robin0371`_ for the PR. 5237 5238 5239.. _@davidszotten: https://github.com/davidszotten 5240.. _@fabioz: https://github.com/fabioz 5241.. _@fogo: https://github.com/fogo 5242.. _@fushi: https://github.com/fushi 5243.. _@Kodiologist: https://github.com/Kodiologist 5244.. _@Kriechi: https://github.com/Kriechi 5245.. _@mandeep: https://github.com/mandeep 5246.. _@mattduck: https://github.com/mattduck 5247.. _@metasyn: https://github.com/metasyn 5248.. _@MichalTHEDUDE: https://github.com/MichalTHEDUDE 5249.. _@ojii: https://github.com/ojii 5250.. _@reutsharabani: https://github.com/reutsharabani 5251.. _@robin0371: https://github.com/robin0371 5252.. _@skylarjhdownes: https://github.com/skylarjhdownes 5253.. _@unsignedint: https://github.com/unsignedint 5254.. _@wheerd: https://github.com/wheerd 5255 5256 5257.. _#1407: https://github.com/pytest-dev/pytest/issues/1407 5258.. _#1512: https://github.com/pytest-dev/pytest/issues/1512 5259.. _#1821: https://github.com/pytest-dev/pytest/issues/1821 5260.. _#1874: https://github.com/pytest-dev/pytest/pull/1874 5261.. _#1937: https://github.com/pytest-dev/pytest/issues/1937 5262.. _#1952: https://github.com/pytest-dev/pytest/pull/1952 5263.. _#2007: https://github.com/pytest-dev/pytest/issues/2007 5264.. _#2013: https://github.com/pytest-dev/pytest/issues/2013 5265.. _#2101: https://github.com/pytest-dev/pytest/pull/2101 5266.. _#2166: https://github.com/pytest-dev/pytest/pull/2166 5267.. _#2208: https://github.com/pytest-dev/pytest/issues/2208 5268.. _#2228: https://github.com/pytest-dev/pytest/issues/2228 5269.. _#2276: https://github.com/pytest-dev/pytest/issues/2276 5270.. _#2308: https://github.com/pytest-dev/pytest/issues/2308 5271.. _#2336: https://github.com/pytest-dev/pytest/issues/2336 5272.. _#2369: https://github.com/pytest-dev/pytest/issues/2369 5273.. _#2383: https://github.com/pytest-dev/pytest/issues/2383 5274.. _#2391: https://github.com/pytest-dev/pytest/issues/2391 5275.. _#533: https://github.com/pytest-dev/pytest/issues/533 5276 5277 5278 52793.0.7 (2017-03-14) 5280================== 5281 5282 5283* Fix issue in assertion rewriting breaking due to modules silently discarding 5284 other modules when importing fails 5285 Notably, importing the ``anydbm`` module is fixed. (`#2248`_). 5286 Thanks `@pfhayes`_ for the PR. 5287 5288* junitxml: Fix problematic case where system-out tag occurred twice per testcase 5289 element in the XML report. Thanks `@kkoukiou`_ for the PR. 5290 5291* Fix regression, pytest now skips unittest correctly if run with ``--pdb`` 5292 (`#2137`_). Thanks to `@gst`_ for the report and `@mbyt`_ for the PR. 5293 5294* Ignore exceptions raised from descriptors (e.g. properties) during Python test collection (`#2234`_). 5295 Thanks to `@bluetech`_. 5296 5297* ``--override-ini`` now correctly overrides some fundamental options like ``python_files`` (`#2238`_). 5298 Thanks `@sirex`_ for the report and `@nicoddemus`_ for the PR. 5299 5300* Replace ``raise StopIteration`` usages in the code by simple ``returns`` to finish generators, in accordance to `PEP-479`_ (`#2160`_). 5301 Thanks to `@nicoddemus`_ for the PR. 5302 5303* Fix internal errors when an unprintable ``AssertionError`` is raised inside a test. 5304 Thanks `@omerhadari`_ for the PR. 5305 5306* Skipping plugin now also works with test items generated by custom collectors (`#2231`_). 5307 Thanks to `@vidartf`_. 5308 5309* Fix trailing whitespace in console output if no .ini file presented (`#2281`_). Thanks `@fbjorn`_ for the PR. 5310 5311* Conditionless ``xfail`` markers no longer rely on the underlying test item 5312 being an instance of ``PyobjMixin``, and can therefore apply to tests not 5313 collected by the built-in python test collector. Thanks `@barneygale`_ for the 5314 PR. 5315 5316 5317.. _@pfhayes: https://github.com/pfhayes 5318.. _@bluetech: https://github.com/bluetech 5319.. _@gst: https://github.com/gst 5320.. _@sirex: https://github.com/sirex 5321.. _@vidartf: https://github.com/vidartf 5322.. _@kkoukiou: https://github.com/KKoukiou 5323.. _@omerhadari: https://github.com/omerhadari 5324.. _@fbjorn: https://github.com/fbjorn 5325 5326.. _#2248: https://github.com/pytest-dev/pytest/issues/2248 5327.. _#2137: https://github.com/pytest-dev/pytest/issues/2137 5328.. _#2160: https://github.com/pytest-dev/pytest/issues/2160 5329.. _#2231: https://github.com/pytest-dev/pytest/issues/2231 5330.. _#2234: https://github.com/pytest-dev/pytest/issues/2234 5331.. _#2238: https://github.com/pytest-dev/pytest/issues/2238 5332.. _#2281: https://github.com/pytest-dev/pytest/issues/2281 5333 5334.. _PEP-479: https://www.python.org/dev/peps/pep-0479/ 5335 5336 53373.0.6 (2017-01-22) 5338================== 5339 5340* pytest no longer generates ``PendingDeprecationWarning`` from its own operations, which was introduced by mistake in version ``3.0.5`` (`#2118`_). 5341 Thanks to `@nicoddemus`_ for the report and `@RonnyPfannschmidt`_ for the PR. 5342 5343 5344* pytest no longer recognizes coroutine functions as yield tests (`#2129`_). 5345 Thanks to `@malinoff`_ for the PR. 5346 5347* Plugins loaded by the ``PYTEST_PLUGINS`` environment variable are now automatically 5348 considered for assertion rewriting (`#2185`_). 5349 Thanks `@nicoddemus`_ for the PR. 5350 5351* Improve error message when pytest.warns fails (`#2150`_). The type(s) of the 5352 expected warnings and the list of caught warnings is added to the 5353 error message. Thanks `@lesteve`_ for the PR. 5354 5355* Fix ``pytester`` internal plugin to work correctly with latest versions of 5356 ``zope.interface`` (`#1989`_). Thanks `@nicoddemus`_ for the PR. 5357 5358* Assert statements of the ``pytester`` plugin again benefit from assertion rewriting (`#1920`_). 5359 Thanks `@RonnyPfannschmidt`_ for the report and `@nicoddemus`_ for the PR. 5360 5361* Specifying tests with colons like ``test_foo.py::test_bar`` for tests in 5362 subdirectories with ini configuration files now uses the correct ini file 5363 (`#2148`_). Thanks `@pelme`_. 5364 5365* Fail ``testdir.runpytest().assert_outcomes()`` explicitly if the pytest 5366 terminal output it relies on is missing. Thanks to `@eli-b`_ for the PR. 5367 5368 5369.. _@barneygale: https://github.com/barneygale 5370.. _@lesteve: https://github.com/lesteve 5371.. _@malinoff: https://github.com/malinoff 5372.. _@pelme: https://github.com/pelme 5373.. _@eli-b: https://github.com/eli-b 5374 5375.. _#2118: https://github.com/pytest-dev/pytest/issues/2118 5376 5377.. _#1989: https://github.com/pytest-dev/pytest/issues/1989 5378.. _#1920: https://github.com/pytest-dev/pytest/issues/1920 5379.. _#2129: https://github.com/pytest-dev/pytest/issues/2129 5380.. _#2148: https://github.com/pytest-dev/pytest/issues/2148 5381.. _#2150: https://github.com/pytest-dev/pytest/issues/2150 5382.. _#2185: https://github.com/pytest-dev/pytest/issues/2185 5383 5384 53853.0.5 (2016-12-05) 5386================== 5387 5388* Add warning when not passing ``option=value`` correctly to ``-o/--override-ini`` (`#2105`_). 5389 Also improved the help documentation. Thanks to `@mbukatov`_ for the report and 5390 `@lwm`_ for the PR. 5391 5392* Now ``--confcutdir`` and ``--junit-xml`` are properly validated if they are directories 5393 and filenames, respectively (`#2089`_ and `#2078`_). Thanks to `@lwm`_ for the PR. 5394 5395* Add hint to error message hinting possible missing ``__init__.py`` (`#478`_). Thanks `@DuncanBetts`_. 5396 5397* More accurately describe when fixture finalization occurs in documentation (`#687`_). Thanks `@DuncanBetts`_. 5398 5399* Provide ``:ref:`` targets for ``recwarn.rst`` so we can use intersphinx referencing. 5400 Thanks to `@dupuy`_ for the report and `@lwm`_ for the PR. 5401 5402* In Python 2, use a simple ``+-`` ASCII string in the string representation of ``pytest.approx`` (for example ``"4 +- 4.0e-06"``) 5403 because it is brittle to handle that in different contexts and representations internally in pytest 5404 which can result in bugs such as `#2111`_. In Python 3, the representation still uses ``±`` (for example ``4 ± 4.0e-06``). 5405 Thanks `@kerrick-lyft`_ for the report and `@nicoddemus`_ for the PR. 5406 5407* Using ``item.Function``, ``item.Module``, etc., is now issuing deprecation warnings, prefer 5408 ``pytest.Function``, ``pytest.Module``, etc., instead (`#2034`_). 5409 Thanks `@nmundar`_ for the PR. 5410 5411* Fix error message using ``approx`` with complex numbers (`#2082`_). 5412 Thanks `@adler-j`_ for the report and `@nicoddemus`_ for the PR. 5413 5414* Fixed false-positives warnings from assertion rewrite hook for modules imported more than 5415 once by the ``pytest_plugins`` mechanism. 5416 Thanks `@nicoddemus`_ for the PR. 5417 5418* Remove an internal cache which could cause hooks from ``conftest.py`` files in 5419 sub-directories to be called in other directories incorrectly (`#2016`_). 5420 Thanks `@d-b-w`_ for the report and `@nicoddemus`_ for the PR. 5421 5422* Remove internal code meant to support earlier Python 3 versions that produced the side effect 5423 of leaving ``None`` in ``sys.modules`` when expressions were evaluated by pytest (for example passing a condition 5424 as a string to ``pytest.mark.skipif``)(`#2103`_). 5425 Thanks `@jaraco`_ for the report and `@nicoddemus`_ for the PR. 5426 5427* Cope gracefully with a .pyc file with no matching .py file (`#2038`_). Thanks 5428 `@nedbat`_. 5429 5430.. _@syre: https://github.com/syre 5431.. _@adler-j: https://github.com/adler-j 5432.. _@d-b-w: https://github.com/d-b-w 5433.. _@DuncanBetts: https://github.com/DuncanBetts 5434.. _@dupuy: https://bitbucket.org/dupuy/ 5435.. _@kerrick-lyft: https://github.com/kerrick-lyft 5436.. _@lwm: https://github.com/lwm 5437.. _@mbukatov: https://github.com/mbukatov 5438.. _@nedbat: https://github.com/nedbat 5439.. _@nmundar: https://github.com/nmundar 5440 5441.. _#2016: https://github.com/pytest-dev/pytest/issues/2016 5442.. _#2034: https://github.com/pytest-dev/pytest/issues/2034 5443.. _#2038: https://github.com/pytest-dev/pytest/issues/2038 5444.. _#2078: https://github.com/pytest-dev/pytest/issues/2078 5445.. _#2082: https://github.com/pytest-dev/pytest/issues/2082 5446.. _#2089: https://github.com/pytest-dev/pytest/issues/2089 5447.. _#2103: https://github.com/pytest-dev/pytest/issues/2103 5448.. _#2105: https://github.com/pytest-dev/pytest/issues/2105 5449.. _#2111: https://github.com/pytest-dev/pytest/issues/2111 5450.. _#478: https://github.com/pytest-dev/pytest/issues/478 5451.. _#687: https://github.com/pytest-dev/pytest/issues/687 5452 5453 54543.0.4 (2016-11-09) 5455================== 5456 5457* Import errors when collecting test modules now display the full traceback (`#1976`_). 5458 Thanks `@cwitty`_ for the report and `@nicoddemus`_ for the PR. 5459 5460* Fix confusing command-line help message for custom options with two or more ``metavar`` properties (`#2004`_). 5461 Thanks `@okulynyak`_ and `@davehunt`_ for the report and `@nicoddemus`_ for the PR. 5462 5463* When loading plugins, import errors which contain non-ascii messages are now properly handled in Python 2 (`#1998`_). 5464 Thanks `@nicoddemus`_ for the PR. 5465 5466* Fixed cyclic reference when ``pytest.raises`` is used in context-manager form (`#1965`_). Also as a 5467 result of this fix, ``sys.exc_info()`` is left empty in both context-manager and function call usages. 5468 Previously, ``sys.exc_info`` would contain the exception caught by the context manager, 5469 even when the expected exception occurred. 5470 Thanks `@MSeifert04`_ for the report and the PR. 5471 5472* Fixed false-positives warnings from assertion rewrite hook for modules that were rewritten but 5473 were later marked explicitly by ``pytest.register_assert_rewrite`` 5474 or implicitly as a plugin (`#2005`_). 5475 Thanks `@RonnyPfannschmidt`_ for the report and `@nicoddemus`_ for the PR. 5476 5477* Report teardown output on test failure (`#442`_). 5478 Thanks `@matclab`_ for the PR. 5479 5480* Fix teardown error message in generated xUnit XML. 5481 Thanks `@gdyuldin`_ for the PR. 5482 5483* Properly handle exceptions in ``multiprocessing`` tasks (`#1984`_). 5484 Thanks `@adborden`_ for the report and `@nicoddemus`_ for the PR. 5485 5486* Clean up unittest TestCase objects after tests are complete (`#1649`_). 5487 Thanks `@d_b_w`_ for the report and PR. 5488 5489 5490.. _@adborden: https://github.com/adborden 5491.. _@cwitty: https://github.com/cwitty 5492.. _@d_b_w: https://github.com/d-b-w 5493.. _@gdyuldin: https://github.com/gdyuldin 5494.. _@matclab: https://github.com/matclab 5495.. _@MSeifert04: https://github.com/MSeifert04 5496.. _@okulynyak: https://github.com/okulynyak 5497 5498.. _#442: https://github.com/pytest-dev/pytest/issues/442 5499.. _#1965: https://github.com/pytest-dev/pytest/issues/1965 5500.. _#1976: https://github.com/pytest-dev/pytest/issues/1976 5501.. _#1984: https://github.com/pytest-dev/pytest/issues/1984 5502.. _#1998: https://github.com/pytest-dev/pytest/issues/1998 5503.. _#2004: https://github.com/pytest-dev/pytest/issues/2004 5504.. _#2005: https://github.com/pytest-dev/pytest/issues/2005 5505.. _#1649: https://github.com/pytest-dev/pytest/issues/1649 5506 5507 55083.0.3 (2016-09-28) 5509================== 5510 5511* The ``ids`` argument to ``parametrize`` again accepts ``unicode`` strings 5512 in Python 2 (`#1905`_). 5513 Thanks `@philpep`_ for the report and `@nicoddemus`_ for the PR. 5514 5515* Assertions are now being rewritten for plugins in development mode 5516 (``pip install -e``) (`#1934`_). 5517 Thanks `@nicoddemus`_ for the PR. 5518 5519* Fix pkg_resources import error in Jython projects (`#1853`_). 5520 Thanks `@raquel-ucl`_ for the PR. 5521 5522* Got rid of ``AttributeError: 'Module' object has no attribute '_obj'`` exception 5523 in Python 3 (`#1944`_). 5524 Thanks `@axil`_ for the PR. 5525 5526* Explain a bad scope value passed to ``@fixture`` declarations or 5527 a ``MetaFunc.parametrize()`` call. 5528 5529* This version includes ``pluggy-0.4.0``, which correctly handles 5530 ``VersionConflict`` errors in plugins (`#704`_). 5531 Thanks `@nicoddemus`_ for the PR. 5532 5533 5534.. _@philpep: https://github.com/philpep 5535.. _@raquel-ucl: https://github.com/raquel-ucl 5536.. _@axil: https://github.com/axil 5537.. _@vlad-dragos: https://github.com/vlad-dragos 5538 5539.. _#1853: https://github.com/pytest-dev/pytest/issues/1853 5540.. _#1905: https://github.com/pytest-dev/pytest/issues/1905 5541.. _#1934: https://github.com/pytest-dev/pytest/issues/1934 5542.. _#1944: https://github.com/pytest-dev/pytest/issues/1944 5543.. _#704: https://github.com/pytest-dev/pytest/issues/704 5544 5545 5546 5547 55483.0.2 (2016-09-01) 5549================== 5550 5551* Improve error message when passing non-string ids to ``pytest.mark.parametrize`` (`#1857`_). 5552 Thanks `@okken`_ for the report and `@nicoddemus`_ for the PR. 5553 5554* Add ``buffer`` attribute to stdin stub class ``pytest.capture.DontReadFromInput`` 5555 Thanks `@joguSD`_ for the PR. 5556 5557* Fix ``UnicodeEncodeError`` when string comparison with unicode has failed. (`#1864`_) 5558 Thanks `@AiOO`_ for the PR. 5559 5560* ``pytest_plugins`` is now handled correctly if defined as a string (as opposed as 5561 a sequence of strings) when modules are considered for assertion rewriting. 5562 Due to this bug, much more modules were being rewritten than necessary 5563 if a test suite uses ``pytest_plugins`` to load internal plugins (`#1888`_). 5564 Thanks `@jaraco`_ for the report and `@nicoddemus`_ for the PR (`#1891`_). 5565 5566* Do not call tearDown and cleanups when running tests from 5567 ``unittest.TestCase`` subclasses with ``--pdb`` 5568 enabled. This allows proper post mortem debugging for all applications 5569 which have significant logic in their tearDown machinery (`#1890`_). Thanks 5570 `@mbyt`_ for the PR. 5571 5572* Fix use of deprecated ``getfuncargvalue`` method in the internal doctest plugin. 5573 Thanks `@ViviCoder`_ for the report (`#1898`_). 5574 5575.. _@joguSD: https://github.com/joguSD 5576.. _@AiOO: https://github.com/AiOO 5577.. _@mbyt: https://github.com/mbyt 5578.. _@ViviCoder: https://github.com/ViviCoder 5579 5580.. _#1857: https://github.com/pytest-dev/pytest/issues/1857 5581.. _#1864: https://github.com/pytest-dev/pytest/issues/1864 5582.. _#1888: https://github.com/pytest-dev/pytest/issues/1888 5583.. _#1891: https://github.com/pytest-dev/pytest/pull/1891 5584.. _#1890: https://github.com/pytest-dev/pytest/issues/1890 5585.. _#1898: https://github.com/pytest-dev/pytest/issues/1898 5586 5587 55883.0.1 (2016-08-23) 5589================== 5590 5591* Fix regression when ``importorskip`` is used at module level (`#1822`_). 5592 Thanks `@jaraco`_ and `@The-Compiler`_ for the report and `@nicoddemus`_ for the PR. 5593 5594* Fix parametrization scope when session fixtures are used in conjunction 5595 with normal parameters in the same call (`#1832`_). 5596 Thanks `@The-Compiler`_ for the report, `@Kingdread`_ and `@nicoddemus`_ for the PR. 5597 5598* Fix internal error when parametrizing tests or fixtures using an empty ``ids`` argument (`#1849`_). 5599 Thanks `@OPpuolitaival`_ for the report and `@nicoddemus`_ for the PR. 5600 5601* Fix loader error when running ``pytest`` embedded in a zipfile. 5602 Thanks `@mbachry`_ for the PR. 5603 5604 5605.. _@Kingdread: https://github.com/Kingdread 5606.. _@mbachry: https://github.com/mbachry 5607.. _@OPpuolitaival: https://github.com/OPpuolitaival 5608 5609.. _#1822: https://github.com/pytest-dev/pytest/issues/1822 5610.. _#1832: https://github.com/pytest-dev/pytest/issues/1832 5611.. _#1849: https://github.com/pytest-dev/pytest/issues/1849 5612 5613 56143.0.0 (2016-08-18) 5615================== 5616 5617**Incompatible changes** 5618 5619 5620A number of incompatible changes were made in this release, with the intent of removing features deprecated for a long 5621time or change existing behaviors in order to make them less surprising/more useful. 5622 5623* Reinterpretation mode has now been removed. Only plain and rewrite 5624 mode are available, consequently the ``--assert=reinterp`` option is 5625 no longer available. This also means files imported from plugins or 5626 ``conftest.py`` will not benefit from improved assertions by 5627 default, you should use ``pytest.register_assert_rewrite()`` to 5628 explicitly turn on assertion rewriting for those files. Thanks 5629 `@flub`_ for the PR. 5630 5631* The following deprecated commandline options were removed: 5632 5633 * ``--genscript``: no longer supported; 5634 * ``--no-assert``: use ``--assert=plain`` instead; 5635 * ``--nomagic``: use ``--assert=plain`` instead; 5636 * ``--report``: use ``-r`` instead; 5637 5638 Thanks to `@RedBeardCode`_ for the PR (`#1664`_). 5639 5640* ImportErrors in plugins now are a fatal error instead of issuing a 5641 pytest warning (`#1479`_). Thanks to `@The-Compiler`_ for the PR. 5642 5643* Removed support code for Python 3 versions < 3.3 (`#1627`_). 5644 5645* Removed all ``py.test-X*`` entry points. The versioned, suffixed entry points 5646 were never documented and a leftover from a pre-virtualenv era. These entry 5647 points also created broken entry points in wheels, so removing them also 5648 removes a source of confusion for users (`#1632`_). 5649 Thanks `@obestwalter`_ for the PR. 5650 5651* ``pytest.skip()`` now raises an error when used to decorate a test function, 5652 as opposed to its original intent (to imperatively skip a test inside a test function). Previously 5653 this usage would cause the entire module to be skipped (`#607`_). 5654 Thanks `@omarkohl`_ for the complete PR (`#1519`_). 5655 5656* Exit tests if a collection error occurs. A poll indicated most users will hit CTRL-C 5657 anyway as soon as they see collection errors, so pytest might as well make that the default behavior (`#1421`_). 5658 A ``--continue-on-collection-errors`` option has been added to restore the previous behaviour. 5659 Thanks `@olegpidsadnyi`_ and `@omarkohl`_ for the complete PR (`#1628`_). 5660 5661* Renamed the pytest ``pdb`` module (plugin) into ``debugging`` to avoid clashes with the builtin ``pdb`` module. 5662 5663* Raise a helpful failure message when requesting a parametrized fixture at runtime, 5664 e.g. with ``request.getfixturevalue``. Previously these parameters were simply 5665 never defined, so a fixture decorated like ``@pytest.fixture(params=[0, 1, 2])`` 5666 only ran once (`#460`_). 5667 Thanks to `@nikratio`_ for the bug report, `@RedBeardCode`_ and `@tomviner`_ for the PR. 5668 5669* ``_pytest.monkeypatch.monkeypatch`` class has been renamed to ``_pytest.monkeypatch.MonkeyPatch`` 5670 so it doesn't conflict with the ``monkeypatch`` fixture. 5671 5672* ``--exitfirst / -x`` can now be overridden by a following ``--maxfail=N`` 5673 and is just a synonym for ``--maxfail=1``. 5674 5675 5676**New Features** 5677 5678* Support nose-style ``__test__`` attribute on methods of classes, 5679 including unittest-style Classes. If set to ``False``, the test will not be 5680 collected. 5681 5682* New ``doctest_namespace`` fixture for injecting names into the 5683 namespace in which doctests run. 5684 Thanks `@milliams`_ for the complete PR (`#1428`_). 5685 5686* New ``--doctest-report`` option available to change the output format of diffs 5687 when running (failing) doctests (implements `#1749`_). 5688 Thanks `@hartym`_ for the PR. 5689 5690* New ``name`` argument to ``pytest.fixture`` decorator which allows a custom name 5691 for a fixture (to solve the funcarg-shadowing-fixture problem). 5692 Thanks `@novas0x2a`_ for the complete PR (`#1444`_). 5693 5694* New ``approx()`` function for easily comparing floating-point numbers in 5695 tests. 5696 Thanks `@kalekundert`_ for the complete PR (`#1441`_). 5697 5698* Ability to add global properties in the final xunit output file by accessing 5699 the internal ``junitxml`` plugin (experimental). 5700 Thanks `@tareqalayan`_ for the complete PR `#1454`_). 5701 5702* New ``ExceptionInfo.match()`` method to match a regular expression on the 5703 string representation of an exception (`#372`_). 5704 Thanks `@omarkohl`_ for the complete PR (`#1502`_). 5705 5706* ``__tracebackhide__`` can now also be set to a callable which then can decide 5707 whether to filter the traceback based on the ``ExceptionInfo`` object passed 5708 to it. Thanks `@The-Compiler`_ for the complete PR (`#1526`_). 5709 5710* New ``pytest_make_parametrize_id(config, val)`` hook which can be used by plugins to provide 5711 friendly strings for custom types. 5712 Thanks `@palaviv`_ for the PR. 5713 5714* ``capsys`` and ``capfd`` now have a ``disabled()`` context-manager method, which 5715 can be used to temporarily disable capture within a test. 5716 Thanks `@nicoddemus`_ for the PR. 5717 5718* New cli flag ``--fixtures-per-test``: shows which fixtures are being used 5719 for each selected test item. Features doc strings of fixtures by default. 5720 Can also show where fixtures are defined if combined with ``-v``. 5721 Thanks `@hackebrot`_ for the PR. 5722 5723* Introduce ``pytest`` command as recommended entry point. Note that ``py.test`` 5724 still works and is not scheduled for removal. Closes proposal 5725 `#1629`_. Thanks `@obestwalter`_ and `@davehunt`_ for the complete PR 5726 (`#1633`_). 5727 5728* New cli flags: 5729 5730 + ``--setup-plan``: performs normal collection and reports 5731 the potential setup and teardown and does not execute any fixtures and tests; 5732 + ``--setup-only``: performs normal collection, executes setup and teardown of 5733 fixtures and reports them; 5734 + ``--setup-show``: performs normal test execution and additionally shows 5735 setup and teardown of fixtures; 5736 + ``--keep-duplicates``: py.test now ignores duplicated paths given in the command 5737 line. To retain the previous behavior where the same test could be run multiple 5738 times by specifying it in the command-line multiple times, pass the ``--keep-duplicates`` 5739 argument (`#1609`_); 5740 5741 Thanks `@d6e`_, `@kvas-it`_, `@sallner`_, `@ioggstream`_ and `@omarkohl`_ for the PRs. 5742 5743* New CLI flag ``--override-ini``/``-o``: overrides values from the ini file. 5744 For example: ``"-o xfail_strict=True"``'. 5745 Thanks `@blueyed`_ and `@fengxx`_ for the PR. 5746 5747* New hooks: 5748 5749 + ``pytest_fixture_setup(fixturedef, request)``: executes fixture setup; 5750 + ``pytest_fixture_post_finalizer(fixturedef)``: called after the fixture's 5751 finalizer and has access to the fixture's result cache. 5752 5753 Thanks `@d6e`_, `@sallner`_. 5754 5755* Issue warnings for asserts whose test is a tuple literal. Such asserts will 5756 never fail because tuples are always truthy and are usually a mistake 5757 (see `#1562`_). Thanks `@kvas-it`_, for the PR. 5758 5759* Allow passing a custom debugger class (e.g. ``--pdbcls=IPython.core.debugger:Pdb``). 5760 Thanks to `@anntzer`_ for the PR. 5761 5762 5763**Changes** 5764 5765* Plugins now benefit from assertion rewriting. Thanks 5766 `@sober7`_, `@nicoddemus`_ and `@flub`_ for the PR. 5767 5768* Change ``report.outcome`` for ``xpassed`` tests to ``"passed"`` in non-strict 5769 mode and ``"failed"`` in strict mode. Thanks to `@hackebrot`_ for the PR 5770 (`#1795`_) and `@gprasad84`_ for report (`#1546`_). 5771 5772* Tests marked with ``xfail(strict=False)`` (the default) now appear in 5773 JUnitXML reports as passing tests instead of skipped. 5774 Thanks to `@hackebrot`_ for the PR (`#1795`_). 5775 5776* Highlight path of the file location in the error report to make it easier to copy/paste. 5777 Thanks `@suzaku`_ for the PR (`#1778`_). 5778 5779* Fixtures marked with ``@pytest.fixture`` can now use ``yield`` statements exactly like 5780 those marked with the ``@pytest.yield_fixture`` decorator. This change renders 5781 ``@pytest.yield_fixture`` deprecated and makes ``@pytest.fixture`` with ``yield`` statements 5782 the preferred way to write teardown code (`#1461`_). 5783 Thanks `@csaftoiu`_ for bringing this to attention and `@nicoddemus`_ for the PR. 5784 5785* Explicitly passed parametrize ids do not get escaped to ascii (`#1351`_). 5786 Thanks `@ceridwen`_ for the PR. 5787 5788* Fixtures are now sorted in the error message displayed when an unknown 5789 fixture is declared in a test function. 5790 Thanks `@nicoddemus`_ for the PR. 5791 5792* ``pytest_terminal_summary`` hook now receives the ``exitstatus`` 5793 of the test session as argument. Thanks `@blueyed`_ for the PR (`#1809`_). 5794 5795* Parametrize ids can accept ``None`` as specific test id, in which case the 5796 automatically generated id for that argument will be used. 5797 Thanks `@palaviv`_ for the complete PR (`#1468`_). 5798 5799* The parameter to xunit-style setup/teardown methods (``setup_method``, 5800 ``setup_module``, etc.) is now optional and may be omitted. 5801 Thanks `@okken`_ for bringing this to attention and `@nicoddemus`_ for the PR. 5802 5803* Improved automatic id generation selection in case of duplicate ids in 5804 parametrize. 5805 Thanks `@palaviv`_ for the complete PR (`#1474`_). 5806 5807* Now pytest warnings summary is shown up by default. Added a new flag 5808 ``--disable-pytest-warnings`` to explicitly disable the warnings summary (`#1668`_). 5809 5810* Make ImportError during collection more explicit by reminding 5811 the user to check the name of the test module/package(s) (`#1426`_). 5812 Thanks `@omarkohl`_ for the complete PR (`#1520`_). 5813 5814* Add ``build/`` and ``dist/`` to the default ``--norecursedirs`` list. Thanks 5815 `@mikofski`_ for the report and `@tomviner`_ for the PR (`#1544`_). 5816 5817* ``pytest.raises`` in the context manager form accepts a custom 5818 ``message`` to raise when no exception occurred. 5819 Thanks `@palaviv`_ for the complete PR (`#1616`_). 5820 5821* ``conftest.py`` files now benefit from assertion rewriting; previously it 5822 was only available for test modules. Thanks `@flub`_, `@sober7`_ and 5823 `@nicoddemus`_ for the PR (`#1619`_). 5824 5825* Text documents without any doctests no longer appear as "skipped". 5826 Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_). 5827 5828* Ensure that a module within a namespace package can be found when it 5829 is specified on the command line together with the ``--pyargs`` 5830 option. Thanks to `@taschini`_ for the PR (`#1597`_). 5831 5832* Always include full assertion explanation during assertion rewriting. The previous behaviour was hiding 5833 sub-expressions that happened to be ``False``, assuming this was redundant information. 5834 Thanks `@bagerard`_ for reporting (`#1503`_). Thanks to `@davehunt`_ and 5835 `@tomviner`_ for the PR. 5836 5837* ``OptionGroup.addoption()`` now checks if option names were already 5838 added before, to make it easier to track down issues like `#1618`_. 5839 Before, you only got exceptions later from ``argparse`` library, 5840 giving no clue about the actual reason for double-added options. 5841 5842* ``yield``-based tests are considered deprecated and will be removed in pytest-4.0. 5843 Thanks `@nicoddemus`_ for the PR. 5844 5845* ``[pytest]`` sections in ``setup.cfg`` files should now be named ``[tool:pytest]`` 5846 to avoid conflicts with other distutils commands (see `#567`_). ``[pytest]`` sections in 5847 ``pytest.ini`` or ``tox.ini`` files are supported and unchanged. 5848 Thanks `@nicoddemus`_ for the PR. 5849 5850* Using ``pytest_funcarg__`` prefix to declare fixtures is considered deprecated and will be 5851 removed in pytest-4.0 (`#1684`_). 5852 Thanks `@nicoddemus`_ for the PR. 5853 5854* Passing a command-line string to ``pytest.main()`` is considered deprecated and scheduled 5855 for removal in pytest-4.0. It is recommended to pass a list of arguments instead (`#1723`_). 5856 5857* Rename ``getfuncargvalue`` to ``getfixturevalue``. ``getfuncargvalue`` is 5858 still present but is now considered deprecated. Thanks to `@RedBeardCode`_ and `@tomviner`_ 5859 for the PR (`#1626`_). 5860 5861* ``optparse`` type usage now triggers DeprecationWarnings (`#1740`_). 5862 5863 5864* ``optparse`` backward compatibility supports float/complex types (`#457`_). 5865 5866* Refined logic for determining the ``rootdir``, considering only valid 5867 paths which fixes a number of issues: `#1594`_, `#1435`_ and `#1471`_. 5868 Updated the documentation according to current behavior. Thanks to 5869 `@blueyed`_, `@davehunt`_ and `@matthiasha`_ for the PR. 5870 5871* Always include full assertion explanation. The previous behaviour was hiding 5872 sub-expressions that happened to be False, assuming this was redundant information. 5873 Thanks `@bagerard`_ for reporting (`#1503`_). Thanks to `@davehunt`_ and 5874 `@tomviner`_ for PR. 5875 5876* Better message in case of not using parametrized variable (see `#1539`_). 5877 Thanks to `@tramwaj29`_ for the PR. 5878 5879* Updated docstrings with a more uniform style. 5880 5881* Add stderr write for ``pytest.exit(msg)`` during startup. Previously the message was never shown. 5882 Thanks `@BeyondEvil`_ for reporting `#1210`_. Thanks to @jgsonesen and 5883 `@tomviner`_ for the PR. 5884 5885* No longer display the incorrect test deselection reason (`#1372`_). 5886 Thanks `@ronnypfannschmidt`_ for the PR. 5887 5888* The ``--resultlog`` command line option has been deprecated: it is little used 5889 and there are more modern and better alternatives (see `#830`_). 5890 Thanks `@nicoddemus`_ for the PR. 5891 5892* Improve error message with fixture lookup errors: add an 'E' to the first 5893 line and '>' to the rest. Fixes `#717`_. Thanks `@blueyed`_ for reporting and 5894 a PR, `@eolo999`_ for the initial PR and `@tomviner`_ for his guidance during 5895 EuroPython2016 sprint. 5896 5897 5898**Bug Fixes** 5899 5900* Parametrize now correctly handles duplicated test ids. 5901 5902* Fix internal error issue when the ``method`` argument is missing for 5903 ``teardown_method()`` (`#1605`_). 5904 5905* Fix exception visualization in case the current working directory (CWD) gets 5906 deleted during testing (`#1235`_). Thanks `@bukzor`_ for reporting. PR by 5907 `@marscher`_. 5908 5909* Improve test output for logical expression with brackets (`#925`_). 5910 Thanks `@DRMacIver`_ for reporting and `@RedBeardCode`_ for the PR. 5911 5912* Create correct diff for strings ending with newlines (`#1553`_). 5913 Thanks `@Vogtinator`_ for reporting and `@RedBeardCode`_ and 5914 `@tomviner`_ for the PR. 5915 5916* ``ConftestImportFailure`` now shows the traceback making it easier to 5917 identify bugs in ``conftest.py`` files (`#1516`_). Thanks `@txomon`_ for 5918 the PR. 5919 5920* Text documents without any doctests no longer appear as "skipped". 5921 Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_). 5922 5923* Fixed collection of classes with custom ``__new__`` method. 5924 Fixes `#1579`_. Thanks to `@Stranger6667`_ for the PR. 5925 5926* Fixed scope overriding inside metafunc.parametrize (`#634`_). 5927 Thanks to `@Stranger6667`_ for the PR. 5928 5929* Fixed the total tests tally in junit xml output (`#1798`_). 5930 Thanks to `@cboelsen`_ for the PR. 5931 5932* Fixed off-by-one error with lines from ``request.node.warn``. 5933 Thanks to `@blueyed`_ for the PR. 5934 5935 5936.. _#1210: https://github.com/pytest-dev/pytest/issues/1210 5937.. _#1235: https://github.com/pytest-dev/pytest/issues/1235 5938.. _#1351: https://github.com/pytest-dev/pytest/issues/1351 5939.. _#1372: https://github.com/pytest-dev/pytest/issues/1372 5940.. _#1421: https://github.com/pytest-dev/pytest/issues/1421 5941.. _#1426: https://github.com/pytest-dev/pytest/issues/1426 5942.. _#1428: https://github.com/pytest-dev/pytest/pull/1428 5943.. _#1435: https://github.com/pytest-dev/pytest/issues/1435 5944.. _#1441: https://github.com/pytest-dev/pytest/pull/1441 5945.. _#1444: https://github.com/pytest-dev/pytest/pull/1444 5946.. _#1454: https://github.com/pytest-dev/pytest/pull/1454 5947.. _#1461: https://github.com/pytest-dev/pytest/pull/1461 5948.. _#1468: https://github.com/pytest-dev/pytest/pull/1468 5949.. _#1471: https://github.com/pytest-dev/pytest/issues/1471 5950.. _#1474: https://github.com/pytest-dev/pytest/pull/1474 5951.. _#1479: https://github.com/pytest-dev/pytest/issues/1479 5952.. _#1502: https://github.com/pytest-dev/pytest/pull/1502 5953.. _#1503: https://github.com/pytest-dev/pytest/issues/1503 5954.. _#1516: https://github.com/pytest-dev/pytest/pull/1516 5955.. _#1519: https://github.com/pytest-dev/pytest/pull/1519 5956.. _#1520: https://github.com/pytest-dev/pytest/pull/1520 5957.. _#1526: https://github.com/pytest-dev/pytest/pull/1526 5958.. _#1539: https://github.com/pytest-dev/pytest/issues/1539 5959.. _#1544: https://github.com/pytest-dev/pytest/issues/1544 5960.. _#1546: https://github.com/pytest-dev/pytest/issues/1546 5961.. _#1553: https://github.com/pytest-dev/pytest/issues/1553 5962.. _#1562: https://github.com/pytest-dev/pytest/issues/1562 5963.. _#1579: https://github.com/pytest-dev/pytest/issues/1579 5964.. _#1580: https://github.com/pytest-dev/pytest/pull/1580 5965.. _#1594: https://github.com/pytest-dev/pytest/issues/1594 5966.. _#1597: https://github.com/pytest-dev/pytest/pull/1597 5967.. _#1605: https://github.com/pytest-dev/pytest/issues/1605 5968.. _#1616: https://github.com/pytest-dev/pytest/pull/1616 5969.. _#1618: https://github.com/pytest-dev/pytest/issues/1618 5970.. _#1619: https://github.com/pytest-dev/pytest/issues/1619 5971.. _#1626: https://github.com/pytest-dev/pytest/pull/1626 5972.. _#1627: https://github.com/pytest-dev/pytest/pull/1627 5973.. _#1628: https://github.com/pytest-dev/pytest/pull/1628 5974.. _#1629: https://github.com/pytest-dev/pytest/issues/1629 5975.. _#1632: https://github.com/pytest-dev/pytest/issues/1632 5976.. _#1633: https://github.com/pytest-dev/pytest/pull/1633 5977.. _#1664: https://github.com/pytest-dev/pytest/pull/1664 5978.. _#1668: https://github.com/pytest-dev/pytest/issues/1668 5979.. _#1684: https://github.com/pytest-dev/pytest/pull/1684 5980.. _#1723: https://github.com/pytest-dev/pytest/pull/1723 5981.. _#1740: https://github.com/pytest-dev/pytest/issues/1740 5982.. _#1749: https://github.com/pytest-dev/pytest/issues/1749 5983.. _#1778: https://github.com/pytest-dev/pytest/pull/1778 5984.. _#1795: https://github.com/pytest-dev/pytest/pull/1795 5985.. _#1798: https://github.com/pytest-dev/pytest/pull/1798 5986.. _#1809: https://github.com/pytest-dev/pytest/pull/1809 5987.. _#372: https://github.com/pytest-dev/pytest/issues/372 5988.. _#457: https://github.com/pytest-dev/pytest/issues/457 5989.. _#460: https://github.com/pytest-dev/pytest/pull/460 5990.. _#567: https://github.com/pytest-dev/pytest/pull/567 5991.. _#607: https://github.com/pytest-dev/pytest/issues/607 5992.. _#634: https://github.com/pytest-dev/pytest/issues/634 5993.. _#717: https://github.com/pytest-dev/pytest/issues/717 5994.. _#830: https://github.com/pytest-dev/pytest/issues/830 5995.. _#925: https://github.com/pytest-dev/pytest/issues/925 5996 5997 5998.. _@anntzer: https://github.com/anntzer 5999.. _@bagerard: https://github.com/bagerard 6000.. _@BeyondEvil: https://github.com/BeyondEvil 6001.. _@blueyed: https://github.com/blueyed 6002.. _@ceridwen: https://github.com/ceridwen 6003.. _@cboelsen: https://github.com/cboelsen 6004.. _@csaftoiu: https://github.com/csaftoiu 6005.. _@d6e: https://github.com/d6e 6006.. _@davehunt: https://github.com/davehunt 6007.. _@DRMacIver: https://github.com/DRMacIver 6008.. _@eolo999: https://github.com/eolo999 6009.. _@fengxx: https://github.com/fengxx 6010.. _@flub: https://github.com/flub 6011.. _@gprasad84: https://github.com/gprasad84 6012.. _@graingert: https://github.com/graingert 6013.. _@hartym: https://github.com/hartym 6014.. _@kalekundert: https://github.com/kalekundert 6015.. _@kvas-it: https://github.com/kvas-it 6016.. _@marscher: https://github.com/marscher 6017.. _@mikofski: https://github.com/mikofski 6018.. _@milliams: https://github.com/milliams 6019.. _@nikratio: https://github.com/nikratio 6020.. _@novas0x2a: https://github.com/novas0x2a 6021.. _@obestwalter: https://github.com/obestwalter 6022.. _@okken: https://github.com/okken 6023.. _@olegpidsadnyi: https://github.com/olegpidsadnyi 6024.. _@omarkohl: https://github.com/omarkohl 6025.. _@palaviv: https://github.com/palaviv 6026.. _@RedBeardCode: https://github.com/RedBeardCode 6027.. _@sallner: https://github.com/sallner 6028.. _@sober7: https://github.com/sober7 6029.. _@Stranger6667: https://github.com/Stranger6667 6030.. _@suzaku: https://github.com/suzaku 6031.. _@tareqalayan: https://github.com/tareqalayan 6032.. _@taschini: https://github.com/taschini 6033.. _@tramwaj29: https://github.com/tramwaj29 6034.. _@txomon: https://github.com/txomon 6035.. _@Vogtinator: https://github.com/Vogtinator 6036.. _@matthiasha: https://github.com/matthiasha 6037 6038 60392.9.2 (2016-05-31) 6040================== 6041 6042**Bug Fixes** 6043 6044* fix `#510`_: skip tests where one parameterize dimension was empty 6045 thanks Alex Stapleton for the Report and `@RonnyPfannschmidt`_ for the PR 6046 6047* Fix Xfail does not work with condition keyword argument. 6048 Thanks `@astraw38`_ for reporting the issue (`#1496`_) and `@tomviner`_ 6049 for PR the (`#1524`_). 6050 6051* Fix win32 path issue when putting custom config file with absolute path 6052 in ``pytest.main("-c your_absolute_path")``. 6053 6054* Fix maximum recursion depth detection when raised error class is not aware 6055 of unicode/encoded bytes. 6056 Thanks `@prusse-martin`_ for the PR (`#1506`_). 6057 6058* Fix ``pytest.mark.skip`` mark when used in strict mode. 6059 Thanks `@pquentin`_ for the PR and `@RonnyPfannschmidt`_ for 6060 showing how to fix the bug. 6061 6062* Minor improvements and fixes to the documentation. 6063 Thanks `@omarkohl`_ for the PR. 6064 6065* Fix ``--fixtures`` to show all fixture definitions as opposed to just 6066 one per fixture name. 6067 Thanks to `@hackebrot`_ for the PR. 6068 6069.. _#510: https://github.com/pytest-dev/pytest/issues/510 6070.. _#1506: https://github.com/pytest-dev/pytest/pull/1506 6071.. _#1496: https://github.com/pytest-dev/pytest/issues/1496 6072.. _#1524: https://github.com/pytest-dev/pytest/pull/1524 6073 6074.. _@prusse-martin: https://github.com/prusse-martin 6075.. _@astraw38: https://github.com/astraw38 6076 6077 60782.9.1 (2016-03-17) 6079================== 6080 6081**Bug Fixes** 6082 6083* Improve error message when a plugin fails to load. 6084 Thanks `@nicoddemus`_ for the PR. 6085 6086* Fix (`#1178 <https://github.com/pytest-dev/pytest/issues/1178>`_): 6087 ``pytest.fail`` with non-ascii characters raises an internal pytest error. 6088 Thanks `@nicoddemus`_ for the PR. 6089 6090* Fix (`#469`_): junit parses report.nodeid incorrectly, when params IDs 6091 contain ``::``. Thanks `@tomviner`_ for the PR (`#1431`_). 6092 6093* Fix (`#578 <https://github.com/pytest-dev/pytest/issues/578>`_): SyntaxErrors 6094 containing non-ascii lines at the point of failure generated an internal 6095 py.test error. 6096 Thanks `@asottile`_ for the report and `@nicoddemus`_ for the PR. 6097 6098* Fix (`#1437`_): When passing in a bytestring regex pattern to parameterize 6099 attempt to decode it as utf-8 ignoring errors. 6100 6101* Fix (`#649`_): parametrized test nodes cannot be specified to run on the command line. 6102 6103* Fix (`#138`_): better reporting for python 3.3+ chained exceptions 6104 6105.. _#1437: https://github.com/pytest-dev/pytest/issues/1437 6106.. _#469: https://github.com/pytest-dev/pytest/issues/469 6107.. _#1431: https://github.com/pytest-dev/pytest/pull/1431 6108.. _#649: https://github.com/pytest-dev/pytest/issues/649 6109.. _#138: https://github.com/pytest-dev/pytest/issues/138 6110 6111.. _@asottile: https://github.com/asottile 6112 6113 61142.9.0 (2016-02-29) 6115================== 6116 6117**New Features** 6118 6119* New ``pytest.mark.skip`` mark, which unconditionally skips marked tests. 6120 Thanks `@MichaelAquilina`_ for the complete PR (`#1040`_). 6121 6122* ``--doctest-glob`` may now be passed multiple times in the command-line. 6123 Thanks `@jab`_ and `@nicoddemus`_ for the PR. 6124 6125* New ``-rp`` and ``-rP`` reporting options give the summary and full output 6126 of passing tests, respectively. Thanks to `@codewarrior0`_ for the PR. 6127 6128* ``pytest.mark.xfail`` now has a ``strict`` option, which makes ``XPASS`` 6129 tests to fail the test suite (defaulting to ``False``). There's also a 6130 ``xfail_strict`` ini option that can be used to configure it project-wise. 6131 Thanks `@rabbbit`_ for the request and `@nicoddemus`_ for the PR (`#1355`_). 6132 6133* ``Parser.addini`` now supports options of type ``bool``. 6134 Thanks `@nicoddemus`_ for the PR. 6135 6136* New ``ALLOW_BYTES`` doctest option. This strips ``b`` prefixes from byte strings 6137 in doctest output (similar to ``ALLOW_UNICODE``). 6138 Thanks `@jaraco`_ for the request and `@nicoddemus`_ for the PR (`#1287`_). 6139 6140* Give a hint on ``KeyboardInterrupt`` to use the ``--fulltrace`` option to show the errors. 6141 Fixes `#1366`_. 6142 Thanks to `@hpk42`_ for the report and `@RonnyPfannschmidt`_ for the PR. 6143 6144* Catch ``IndexError`` exceptions when getting exception source location. 6145 Fixes a pytest internal error for dynamically generated code (fixtures and tests) 6146 where source lines are fake by intention. 6147 6148**Changes** 6149 6150* **Important**: `py.code <https://pylib.readthedocs.io/en/stable/code.html>`_ has been 6151 merged into the ``pytest`` repository as ``pytest._code``. This decision 6152 was made because ``py.code`` had very few uses outside ``pytest`` and the 6153 fact that it was in a different repository made it difficult to fix bugs on 6154 its code in a timely manner. The team hopes with this to be able to better 6155 refactor out and improve that code. 6156 This change shouldn't affect users, but it is useful to let users aware 6157 if they encounter any strange behavior. 6158 6159 Keep in mind that the code for ``pytest._code`` is **private** and 6160 **experimental**, so you definitely should not import it explicitly! 6161 6162 Please note that the original ``py.code`` is still available in 6163 `pylib <https://pylib.readthedocs.io>`_. 6164 6165* ``pytest_enter_pdb`` now optionally receives the pytest config object. 6166 Thanks `@nicoddemus`_ for the PR. 6167 6168* Removed code and documentation for Python 2.5 or lower versions, 6169 including removal of the obsolete ``_pytest.assertion.oldinterpret`` module. 6170 Thanks `@nicoddemus`_ for the PR (`#1226`_). 6171 6172* Comparisons now always show up in full when ``CI`` or ``BUILD_NUMBER`` is 6173 found in the environment, even when ``-vv`` isn't used. 6174 Thanks `@The-Compiler`_ for the PR. 6175 6176* ``--lf`` and ``--ff`` now support long names: ``--last-failed`` and 6177 ``--failed-first`` respectively. 6178 Thanks `@MichaelAquilina`_ for the PR. 6179 6180* Added expected exceptions to ``pytest.raises`` fail message. 6181 6182* Collection only displays progress ("collecting X items") when in a terminal. 6183 This avoids cluttering the output when using ``--color=yes`` to obtain 6184 colors in CI integrations systems (`#1397`_). 6185 6186**Bug Fixes** 6187 6188* The ``-s`` and ``-c`` options should now work under ``xdist``; 6189 ``Config.fromdictargs`` now represents its input much more faithfully. 6190 Thanks to `@bukzor`_ for the complete PR (`#680`_). 6191 6192* Fix (`#1290`_): support Python 3.5's ``@`` operator in assertion rewriting. 6193 Thanks `@Shinkenjoe`_ for report with test case and `@tomviner`_ for the PR. 6194 6195* Fix formatting utf-8 explanation messages (`#1379`_). 6196 Thanks `@biern`_ for the PR. 6197 6198* Fix `traceback style docs`_ to describe all of the available options 6199 (auto/long/short/line/native/no), with ``auto`` being the default since v2.6. 6200 Thanks `@hackebrot`_ for the PR. 6201 6202* Fix (`#1422`_): junit record_xml_property doesn't allow multiple records 6203 with same name. 6204 6205.. _`traceback style docs`: https://pytest.org/en/stable/usage.html#modifying-python-traceback-printing 6206 6207.. _#1609: https://github.com/pytest-dev/pytest/issues/1609 6208.. _#1422: https://github.com/pytest-dev/pytest/issues/1422 6209.. _#1379: https://github.com/pytest-dev/pytest/issues/1379 6210.. _#1366: https://github.com/pytest-dev/pytest/issues/1366 6211.. _#1040: https://github.com/pytest-dev/pytest/pull/1040 6212.. _#680: https://github.com/pytest-dev/pytest/issues/680 6213.. _#1287: https://github.com/pytest-dev/pytest/pull/1287 6214.. _#1226: https://github.com/pytest-dev/pytest/pull/1226 6215.. _#1290: https://github.com/pytest-dev/pytest/pull/1290 6216.. _#1355: https://github.com/pytest-dev/pytest/pull/1355 6217.. _#1397: https://github.com/pytest-dev/pytest/issues/1397 6218.. _@biern: https://github.com/biern 6219.. _@MichaelAquilina: https://github.com/MichaelAquilina 6220.. _@bukzor: https://github.com/bukzor 6221.. _@hpk42: https://github.com/hpk42 6222.. _@nicoddemus: https://github.com/nicoddemus 6223.. _@jab: https://github.com/jab 6224.. _@codewarrior0: https://github.com/codewarrior0 6225.. _@jaraco: https://github.com/jaraco 6226.. _@The-Compiler: https://github.com/The-Compiler 6227.. _@Shinkenjoe: https://github.com/Shinkenjoe 6228.. _@tomviner: https://github.com/tomviner 6229.. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt 6230.. _@rabbbit: https://github.com/rabbbit 6231.. _@hackebrot: https://github.com/hackebrot 6232.. _@pquentin: https://github.com/pquentin 6233.. _@ioggstream: https://github.com/ioggstream 6234 62352.8.7 (2016-01-24) 6236================== 6237 6238- fix #1338: use predictable object resolution for monkeypatch 6239 62402.8.6 (2016-01-21) 6241================== 6242 6243- fix #1259: allow for double nodeids in junitxml, 6244 this was a regression failing plugins combinations 6245 like pytest-pep8 + pytest-flakes 6246 6247- Workaround for exception that occurs in pyreadline when using 6248 ``--pdb`` with standard I/O capture enabled. 6249 Thanks Erik M. Bray for the PR. 6250 6251- fix #900: Better error message in case the target of a ``monkeypatch`` call 6252 raises an ``ImportError``. 6253 6254- fix #1292: monkeypatch calls (setattr, setenv, etc.) are now O(1). 6255 Thanks David R. MacIver for the report and Bruno Oliveira for the PR. 6256 6257- fix #1223: captured stdout and stderr are now properly displayed before 6258 entering pdb when ``--pdb`` is used instead of being thrown away. 6259 Thanks Cal Leeming for the PR. 6260 6261- fix #1305: pytest warnings emitted during ``pytest_terminal_summary`` are now 6262 properly displayed. 6263 Thanks Ionel Maries Cristian for the report and Bruno Oliveira for the PR. 6264 6265- fix #628: fixed internal UnicodeDecodeError when doctests contain unicode. 6266 Thanks Jason R. Coombs for the report and Bruno Oliveira for the PR. 6267 6268- fix #1334: Add captured stdout to jUnit XML report on setup error. 6269 Thanks Georgy Dyuldin for the PR. 6270 6271 62722.8.5 (2015-12-11) 6273================== 6274 6275- fix #1243: fixed issue where class attributes injected during collection could break pytest. 6276 PR by Alexei Kozlenok, thanks Ronny Pfannschmidt and Bruno Oliveira for the review and help. 6277 6278- fix #1074: precompute junitxml chunks instead of storing the whole tree in objects 6279 Thanks Bruno Oliveira for the report and Ronny Pfannschmidt for the PR 6280 6281- fix #1238: fix ``pytest.deprecated_call()`` receiving multiple arguments 6282 (Regression introduced in 2.8.4). Thanks Alex Gaynor for the report and 6283 Bruno Oliveira for the PR. 6284 6285 62862.8.4 (2015-12-06) 6287================== 6288 6289- fix #1190: ``deprecated_call()`` now works when the deprecated 6290 function has been already called by another test in the same 6291 module. Thanks Mikhail Chernykh for the report and Bruno Oliveira for the 6292 PR. 6293 6294- fix #1198: ``--pastebin`` option now works on Python 3. Thanks 6295 Mehdy Khoshnoody for the PR. 6296 6297- fix #1219: ``--pastebin`` now works correctly when captured output contains 6298 non-ascii characters. Thanks Bruno Oliveira for the PR. 6299 6300- fix #1204: another error when collecting with a nasty __getattr__(). 6301 Thanks Florian Bruhin for the PR. 6302 6303- fix the summary printed when no tests did run. 6304 Thanks Florian Bruhin for the PR. 6305- fix #1185 - ensure MANIFEST.in exactly matches what should go to a sdist 6306 6307- a number of documentation modernizations wrt good practices. 6308 Thanks Bruno Oliveira for the PR. 6309 63102.8.3 (2015-11-18) 6311================== 6312 6313- fix #1169: add __name__ attribute to testcases in TestCaseFunction to 6314 support the @unittest.skip decorator on functions and methods. 6315 Thanks Lee Kamentsky for the PR. 6316 6317- fix #1035: collecting tests if test module level obj has __getattr__(). 6318 Thanks Suor for the report and Bruno Oliveira / Tom Viner for the PR. 6319 6320- fix #331: don't collect tests if their failure cannot be reported correctly 6321 e.g. they are a callable instance of a class. 6322 6323- fix #1133: fixed internal error when filtering tracebacks where one entry 6324 belongs to a file which is no longer available. 6325 Thanks Bruno Oliveira for the PR. 6326 6327- enhancement made to highlight in red the name of the failing tests so 6328 they stand out in the output. 6329 Thanks Gabriel Reis for the PR. 6330 6331- add more talks to the documentation 6332- extend documentation on the --ignore cli option 6333- use pytest-runner for setuptools integration 6334- minor fixes for interaction with OS X El Capitan 6335 system integrity protection (thanks Florian) 6336 6337 63382.8.2 (2015-10-07) 6339================== 6340 6341- fix #1085: proper handling of encoding errors when passing encoded byte 6342 strings to pytest.parametrize in Python 2. 6343 Thanks Themanwithoutaplan for the report and Bruno Oliveira for the PR. 6344 6345- fix #1087: handling SystemError when passing empty byte strings to 6346 pytest.parametrize in Python 3. 6347 Thanks Paul Kehrer for the report and Bruno Oliveira for the PR. 6348 6349- fix #995: fixed internal error when filtering tracebacks where one entry 6350 was generated by an exec() statement. 6351 Thanks Daniel Hahler, Ashley C Straw, Philippe Gauthier and Pavel Savchenko 6352 for contributing and Bruno Oliveira for the PR. 6353 6354- fix #1100 and #1057: errors when using autouse fixtures and doctest modules. 6355 Thanks Sergey B Kirpichev and Vital Kudzelka for contributing and Bruno 6356 Oliveira for the PR. 6357 63582.8.1 (2015-09-29) 6359================== 6360 6361- fix #1034: Add missing nodeid on pytest_logwarning call in 6362 addhook. Thanks Simon Gomizelj for the PR. 6363 6364- 'deprecated_call' is now only satisfied with a DeprecationWarning or 6365 PendingDeprecationWarning. Before 2.8.0, it accepted any warning, and 2.8.0 6366 made it accept only DeprecationWarning (but not PendingDeprecationWarning). 6367 Thanks Alex Gaynor for the issue and Eric Hunsberger for the PR. 6368 6369- fix issue #1073: avoid calling __getattr__ on potential plugin objects. 6370 This fixes an incompatibility with pytest-django. Thanks Andreas Pelme, 6371 Bruno Oliveira and Ronny Pfannschmidt for contributing and Holger Krekel 6372 for the fix. 6373 6374- Fix issue #704: handle versionconflict during plugin loading more 6375 gracefully. Thanks Bruno Oliveira for the PR. 6376 6377- Fix issue #1064: ""--junitxml" regression when used with the 6378 "pytest-xdist" plugin, with test reports being assigned to the wrong tests. 6379 Thanks Daniel Grunwald for the report and Bruno Oliveira for the PR. 6380 6381- (experimental) adapt more SEMVER style versioning and change meaning of 6382 master branch in git repo: "master" branch now keeps the bug fixes, changes 6383 aimed for micro releases. "features" branch will only be released 6384 with minor or major pytest releases. 6385 6386- Fix issue #766 by removing documentation references to distutils. 6387 Thanks Russel Winder. 6388 6389- Fix issue #1030: now byte-strings are escaped to produce item node ids 6390 to make them always serializable. 6391 Thanks Andy Freeland for the report and Bruno Oliveira for the PR. 6392 6393- Python 2: if unicode parametrized values are convertible to ascii, their 6394 ascii representation is used for the node id. 6395 6396- Fix issue #411: Add __eq__ method to assertion comparison example. 6397 Thanks Ben Webb. 6398- Fix issue #653: deprecated_call can be used as context manager. 6399 6400- fix issue 877: properly handle assertion explanations with non-ascii repr 6401 Thanks Mathieu Agopian for the report and Ronny Pfannschmidt for the PR. 6402 6403- fix issue 1029: transform errors when writing cache values into pytest-warnings 6404 64052.8.0 (2015-09-18) 6406================== 6407 6408- new ``--lf`` and ``-ff`` options to run only the last failing tests or 6409 "failing tests first" from the last run. This functionality is provided 6410 through porting the formerly external pytest-cache plugin into pytest core. 6411 BACKWARD INCOMPAT: if you used pytest-cache's functionality to persist 6412 data between test runs be aware that we don't serialize sets anymore. 6413 Thanks Ronny Pfannschmidt for most of the merging work. 6414 6415- "-r" option now accepts "a" to include all possible reports, similar 6416 to passing "fEsxXw" explicitly (issue960). 6417 Thanks Abhijeet Kasurde for the PR. 6418 6419- avoid python3.5 deprecation warnings by introducing version 6420 specific inspection helpers, thanks Michael Droettboom. 6421 6422- fix issue562: @nose.tools.istest now fully respected. 6423 6424- fix issue934: when string comparison fails and a diff is too large to display 6425 without passing -vv, still show a few lines of the diff. 6426 Thanks Florian Bruhin for the report and Bruno Oliveira for the PR. 6427 6428- fix issue736: Fix a bug where fixture params would be discarded when combined 6429 with parametrization markers. 6430 Thanks to Markus Unterwaditzer for the PR. 6431 6432- fix issue710: introduce ALLOW_UNICODE doctest option: when enabled, the 6433 ``u`` prefix is stripped from unicode strings in expected doctest output. This 6434 allows doctests which use unicode to run in Python 2 and 3 unchanged. 6435 Thanks Jason R. Coombs for the report and Bruno Oliveira for the PR. 6436 6437- parametrize now also generates meaningful test IDs for enum, regex and class 6438 objects (as opposed to class instances). 6439 Thanks to Florian Bruhin for the PR. 6440 6441- Add 'warns' to assert that warnings are thrown (like 'raises'). 6442 Thanks to Eric Hunsberger for the PR. 6443 6444- Fix issue683: Do not apply an already applied mark. Thanks ojake for the PR. 6445 6446- Deal with capturing failures better so fewer exceptions get lost to 6447 /dev/null. Thanks David Szotten for the PR. 6448 6449- fix issue730: deprecate and warn about the --genscript option. 6450 Thanks Ronny Pfannschmidt for the report and Christian Pommranz for the PR. 6451 6452- fix issue751: multiple parametrize with ids bug if it parametrizes class with 6453 two or more test methods. Thanks Sergey Chipiga for reporting and Jan 6454 Bednarik for PR. 6455 6456- fix issue82: avoid loading conftest files from setup.cfg/pytest.ini/tox.ini 6457 files and upwards by default (--confcutdir can still be set to override this). 6458 Thanks Bruno Oliveira for the PR. 6459 6460- fix issue768: docstrings found in python modules were not setting up session 6461 fixtures. Thanks Jason R. Coombs for reporting and Bruno Oliveira for the PR. 6462 6463- added ``tmpdir_factory``, a session-scoped fixture that can be used to create 6464 directories under the base temporary directory. Previously this object was 6465 installed as a ``_tmpdirhandler`` attribute of the ``config`` object, but now it 6466 is part of the official API and using ``config._tmpdirhandler`` is 6467 deprecated. 6468 Thanks Bruno Oliveira for the PR. 6469 6470- fix issue808: pytest's internal assertion rewrite hook now implements the 6471 optional PEP302 get_data API so tests can access data files next to them. 6472 Thanks xmo-odoo for request and example and Bruno Oliveira for 6473 the PR. 6474 6475- rootdir and inifile are now displayed during usage errors to help 6476 users diagnose problems such as unexpected ini files which add 6477 unknown options being picked up by pytest. Thanks to Pavel Savchenko for 6478 bringing the problem to attention in #821 and Bruno Oliveira for the PR. 6479 6480- Summary bar now is colored yellow for warning 6481 situations such as: all tests either were skipped or xpass/xfailed, 6482 or no tests were run at all (this is a partial fix for issue500). 6483 6484- fix issue812: pytest now exits with status code 5 in situations where no 6485 tests were run at all, such as the directory given in the command line does 6486 not contain any tests or as result of a command line option filters 6487 all out all tests (-k for example). 6488 Thanks Eric Siegerman (issue812) and Bruno Oliveira for the PR. 6489 6490- Summary bar now is colored yellow for warning 6491 situations such as: all tests either were skipped or xpass/xfailed, 6492 or no tests were run at all (related to issue500). 6493 Thanks Eric Siegerman. 6494 6495- New ``testpaths`` ini option: list of directories to search for tests 6496 when executing pytest from the root directory. This can be used 6497 to speed up test collection when a project has well specified directories 6498 for tests, being usually more practical than configuring norecursedirs for 6499 all directories that do not contain tests. 6500 Thanks to Adrian for idea (#694) and Bruno Oliveira for the PR. 6501 6502- fix issue713: JUnit XML reports for doctest failures. 6503 Thanks Punyashloka Biswal. 6504 6505- fix issue970: internal pytest warnings now appear as "pytest-warnings" in 6506 the terminal instead of "warnings", so it is clear for users that those 6507 warnings are from pytest and not from the builtin "warnings" module. 6508 Thanks Bruno Oliveira. 6509 6510- Include setup and teardown in junitxml test durations. 6511 Thanks Janne Vanhala. 6512 6513- fix issue735: assertion failures on debug versions of Python 3.4+ 6514 6515- new option ``--import-mode`` to allow to change test module importing 6516 behaviour to append to sys.path instead of prepending. This better allows 6517 to run test modules against installed versions of a package even if the 6518 package under test has the same import root. In this example:: 6519 6520 testing/__init__.py 6521 testing/test_pkg_under_test.py 6522 pkg_under_test/ 6523 6524 the tests will run against the installed version 6525 of pkg_under_test when ``--import-mode=append`` is used whereas 6526 by default they would always pick up the local version. Thanks Holger Krekel. 6527 6528- pytester: add method ``TmpTestdir.delete_loaded_modules()``, and call it 6529 from ``inline_run()`` to allow temporary modules to be reloaded. 6530 Thanks Eduardo Schettino. 6531 6532- internally refactor pluginmanager API and code so that there 6533 is a clear distinction between a pytest-agnostic rather simple 6534 pluginmanager and the PytestPluginManager which adds a lot of 6535 behaviour, among it handling of the local conftest files. 6536 In terms of documented methods this is a backward compatible 6537 change but it might still break 3rd party plugins which relied on 6538 details like especially the pluginmanager.add_shutdown() API. 6539 Thanks Holger Krekel. 6540 6541- pluginmanagement: introduce ``pytest.hookimpl`` and 6542 ``pytest.hookspec`` decorators for setting impl/spec 6543 specific parameters. This substitutes the previous 6544 now deprecated use of ``pytest.mark`` which is meant to 6545 contain markers for test functions only. 6546 6547- write/refine docs for "writing plugins" which now have their 6548 own page and are separate from the "using/installing plugins`` page. 6549 6550- fix issue732: properly unregister plugins from any hook calling 6551 sites allowing to have temporary plugins during test execution. 6552 6553- deprecate and warn about ``__multicall__`` argument in hook 6554 implementations. Use the ``hookwrapper`` mechanism instead already 6555 introduced with pytest-2.7. 6556 6557- speed up pytest's own test suite considerably by using inprocess 6558 tests by default (testrun can be modified with --runpytest=subprocess 6559 to create subprocesses in many places instead). The main 6560 APIs to run pytest in a test is "runpytest()" or "runpytest_subprocess" 6561 and "runpytest_inprocess" if you need a particular way of running 6562 the test. In all cases you get back a RunResult but the inprocess 6563 one will also have a "reprec" attribute with the recorded events/reports. 6564 6565- fix monkeypatch.setattr("x.y", raising=False) to actually not raise 6566 if "y" is not a pre-existing attribute. Thanks Florian Bruhin. 6567 6568- fix issue741: make running output from testdir.run copy/pasteable 6569 Thanks Bruno Oliveira. 6570 6571- add a new ``--noconftest`` argument which ignores all ``conftest.py`` files. 6572 6573- add ``file`` and ``line`` attributes to JUnit-XML output. 6574 6575- fix issue890: changed extension of all documentation files from ``txt`` to 6576 ``rst``. Thanks to Abhijeet for the PR. 6577 6578- fix issue714: add ability to apply indirect=True parameter on particular argnames. 6579 Thanks Elizaveta239. 6580 6581- fix issue890: changed extension of all documentation files from ``txt`` to 6582 ``rst``. Thanks to Abhijeet for the PR. 6583 6584- fix issue957: "# doctest: SKIP" option will now register doctests as SKIPPED 6585 rather than PASSED. 6586 Thanks Thomas Grainger for the report and Bruno Oliveira for the PR. 6587 6588- issue951: add new record_xml_property fixture, that supports logging 6589 additional information on xml output. Thanks David Diaz for the PR. 6590 6591- issue949: paths after normal options (for example ``-s``, ``-v``, etc) are now 6592 properly used to discover ``rootdir`` and ``ini`` files. 6593 Thanks Peter Lauri for the report and Bruno Oliveira for the PR. 6594 65952.7.3 (2015-09-15) 6596================== 6597 6598- Allow 'dev', 'rc', or other non-integer version strings in ``importorskip``. 6599 Thanks to Eric Hunsberger for the PR. 6600 6601- fix issue856: consider --color parameter in all outputs (for example 6602 --fixtures). Thanks Barney Gale for the report and Bruno Oliveira for the PR. 6603 6604- fix issue855: passing str objects as ``plugins`` argument to pytest.main 6605 is now interpreted as a module name to be imported and registered as a 6606 plugin, instead of silently having no effect. 6607 Thanks xmo-odoo for the report and Bruno Oliveira for the PR. 6608 6609- fix issue744: fix for ast.Call changes in Python 3.5+. Thanks 6610 Guido van Rossum, Matthias Bussonnier, Stefan Zimmermann and 6611 Thomas Kluyver. 6612 6613- fix issue842: applying markers in classes no longer propagate this markers 6614 to superclasses which also have markers. 6615 Thanks xmo-odoo for the report and Bruno Oliveira for the PR. 6616 6617- preserve warning functions after call to pytest.deprecated_call. Thanks 6618 Pieter Mulder for PR. 6619 6620- fix issue854: autouse yield_fixtures defined as class members of 6621 unittest.TestCase subclasses now work as expected. 6622 Thannks xmo-odoo for the report and Bruno Oliveira for the PR. 6623 6624- fix issue833: --fixtures now shows all fixtures of collected test files, instead of just the 6625 fixtures declared on the first one. 6626 Thanks Florian Bruhin for reporting and Bruno Oliveira for the PR. 6627 6628- fix issue863: skipped tests now report the correct reason when a skip/xfail 6629 condition is met when using multiple markers. 6630 Thanks Raphael Pierzina for reporting and Bruno Oliveira for the PR. 6631 6632- optimized tmpdir fixture initialization, which should make test sessions 6633 faster (specially when using pytest-xdist). The only visible effect 6634 is that now pytest uses a subdirectory in the $TEMP directory for all 6635 directories created by this fixture (defaults to $TEMP/pytest-$USER). 6636 Thanks Bruno Oliveira for the PR. 6637 66382.7.2 (2015-06-23) 6639================== 6640 6641- fix issue767: pytest.raises value attribute does not contain the exception 6642 instance on Python 2.6. Thanks Eric Siegerman for providing the test 6643 case and Bruno Oliveira for PR. 6644 6645- Automatically create directory for junitxml and results log. 6646 Thanks Aron Curzon. 6647 6648- fix issue713: JUnit XML reports for doctest failures. 6649 Thanks Punyashloka Biswal. 6650 6651- fix issue735: assertion failures on debug versions of Python 3.4+ 6652 Thanks Benjamin Peterson. 6653 6654- fix issue114: skipif marker reports to internal skipping plugin; 6655 Thanks Floris Bruynooghe for reporting and Bruno Oliveira for the PR. 6656 6657- fix issue748: unittest.SkipTest reports to internal pytest unittest plugin. 6658 Thanks Thomas De Schampheleire for reporting and Bruno Oliveira for the PR. 6659 6660- fix issue718: failed to create representation of sets containing unsortable 6661 elements in python 2. Thanks Edison Gustavo Muenz. 6662 6663- fix issue756, fix issue752 (and similar issues): depend on py-1.4.29 6664 which has a refined algorithm for traceback generation. 6665 6666 66672.7.1 (2015-05-19) 6668================== 6669 6670- fix issue731: do not get confused by the braces which may be present 6671 and unbalanced in an object's repr while collapsing False 6672 explanations. Thanks Carl Meyer for the report and test case. 6673 6674- fix issue553: properly handling inspect.getsourcelines failures in 6675 FixtureLookupError which would lead to an internal error, 6676 obfuscating the original problem. Thanks talljosh for initial 6677 diagnose/patch and Bruno Oliveira for final patch. 6678 6679- fix issue660: properly report scope-mismatch-access errors 6680 independently from ordering of fixture arguments. Also 6681 avoid the pytest internal traceback which does not provide 6682 information to the user. Thanks Holger Krekel. 6683 6684- streamlined and documented release process. Also all versions 6685 (in setup.py and documentation generation) are now read 6686 from _pytest/__init__.py. Thanks Holger Krekel. 6687 6688- fixed docs to remove the notion that yield-fixtures are experimental. 6689 They are here to stay :) Thanks Bruno Oliveira. 6690 6691- Support building wheels by using environment markers for the 6692 requirements. Thanks Ionel Maries Cristian. 6693 6694- fixed regression to 2.6.4 which surfaced e.g. in lost stdout capture printing 6695 when tests raised SystemExit. Thanks Holger Krekel. 6696 6697- reintroduced _pytest fixture of the pytester plugin which is used 6698 at least by pytest-xdist. 6699 67002.7.0 (2015-03-26) 6701================== 6702 6703- fix issue435: make reload() work when assert rewriting is active. 6704 Thanks Daniel Hahler. 6705 6706- fix issue616: conftest.py files and their contained fixtures are now 6707 properly considered for visibility, independently from the exact 6708 current working directory and test arguments that are used. 6709 Many thanks to Eric Siegerman and his PR235 which contains 6710 systematic tests for conftest visibility and now passes. 6711 This change also introduces the concept of a ``rootdir`` which 6712 is printed as a new pytest header and documented in the pytest 6713 customize web page. 6714 6715- change reporting of "diverted" tests, i.e. tests that are collected 6716 in one file but actually come from another (e.g. when tests in a test class 6717 come from a base class in a different file). We now show the nodeid 6718 and indicate via a postfix the other file. 6719 6720- add ability to set command line options by environment variable PYTEST_ADDOPTS. 6721 6722- added documentation on the new pytest-dev teams on bitbucket and 6723 github. See https://pytest.org/en/stable/contributing.html . 6724 Thanks to Anatoly for pushing and initial work on this. 6725 6726- fix issue650: new option ``--docttest-ignore-import-errors`` which 6727 will turn import errors in doctests into skips. Thanks Charles Cloud 6728 for the complete PR. 6729 6730- fix issue655: work around different ways that cause python2/3 6731 to leak sys.exc_info into fixtures/tests causing failures in 3rd party code 6732 6733- fix issue615: assertion rewriting did not correctly escape % signs 6734 when formatting boolean operations, which tripped over mixing 6735 booleans with modulo operators. Thanks to Tom Viner for the report, 6736 triaging and fix. 6737 6738- implement issue351: add ability to specify parametrize ids as a callable 6739 to generate custom test ids. Thanks Brianna Laugher for the idea and 6740 implementation. 6741 6742- introduce and document new hookwrapper mechanism useful for plugins 6743 which want to wrap the execution of certain hooks for their purposes. 6744 This supersedes the undocumented ``__multicall__`` protocol which 6745 pytest itself and some external plugins use. Note that pytest-2.8 6746 is scheduled to drop supporting the old ``__multicall__`` 6747 and only support the hookwrapper protocol. 6748 6749- majorly speed up invocation of plugin hooks 6750 6751- use hookwrapper mechanism in builtin pytest plugins. 6752 6753- add a doctest ini option for doctest flags, thanks Holger Peters. 6754 6755- add note to docs that if you want to mark a parameter and the 6756 parameter is a callable, you also need to pass in a reason to disambiguate 6757 it from the "decorator" case. Thanks Tom Viner. 6758 6759- "python_classes" and "python_functions" options now support glob-patterns 6760 for test discovery, as discussed in issue600. Thanks Ldiary Translations. 6761 6762- allow to override parametrized fixtures with non-parametrized ones and vice versa (bubenkoff). 6763 6764- fix issue463: raise specific error for 'parameterize' misspelling (pfctdayelise). 6765 6766- On failure, the ``sys.last_value``, ``sys.last_type`` and 6767 ``sys.last_traceback`` are set, so that a user can inspect the error 6768 via postmortem debugging (almarklein). 6769 67702.6.4 (2014-10-24) 6771================== 6772 6773- Improve assertion failure reporting on iterables, by using ndiff and 6774 pprint. 6775 6776- removed outdated japanese docs from source tree. 6777 6778- docs for "pytest_addhooks" hook. Thanks Bruno Oliveira. 6779 6780- updated plugin index docs. Thanks Bruno Oliveira. 6781 6782- fix issue557: with "-k" we only allow the old style "-" for negation 6783 at the beginning of strings and even that is deprecated. Use "not" instead. 6784 This should allow to pick parametrized tests where "-" appeared in the parameter. 6785 6786- fix issue604: Escape % character in the assertion message. 6787 6788- fix issue620: add explanation in the --genscript target about what 6789 the binary blob means. Thanks Dinu Gherman. 6790 6791- fix issue614: fixed pastebin support. 6792 6793 6794- fix issue620: add explanation in the --genscript target about what 6795 the binary blob means. Thanks Dinu Gherman. 6796 6797- fix issue614: fixed pastebin support. 6798 67992.6.3 (2014-09-24) 6800================== 6801 6802- fix issue575: xunit-xml was reporting collection errors as failures 6803 instead of errors, thanks Oleg Sinyavskiy. 6804 6805- fix issue582: fix setuptools example, thanks Laszlo Papp and Ronny 6806 Pfannschmidt. 6807 6808- Fix infinite recursion bug when pickling capture.EncodedFile, thanks 6809 Uwe Schmitt. 6810 6811- fix issue589: fix bad interaction with numpy and others when showing 6812 exceptions. Check for precise "maximum recursion depth exceed" exception 6813 instead of presuming any RuntimeError is that one (implemented in py 6814 dep). Thanks Charles Cloud for analysing the issue. 6815 6816- fix conftest related fixture visibility issue: when running with a 6817 CWD outside of a test package pytest would get fixture discovery wrong. 6818 Thanks to Wolfgang Schnerring for figuring out a reproducible example. 6819 6820- Introduce pytest_enter_pdb hook (needed e.g. by pytest_timeout to cancel the 6821 timeout when interactively entering pdb). Thanks Wolfgang Schnerring. 6822 6823- check xfail/skip also with non-python function test items. Thanks 6824 Floris Bruynooghe. 6825 68262.6.2 (2014-09-05) 6827================== 6828 6829- Added function pytest.freeze_includes(), which makes it easy to embed 6830 pytest into executables using tools like cx_freeze. 6831 See docs for examples and rationale. Thanks Bruno Oliveira. 6832 6833- Improve assertion rewriting cache invalidation precision. 6834 6835- fixed issue561: adapt autouse fixture example for python3. 6836 6837- fixed issue453: assertion rewriting issue with __repr__ containing 6838 "\n{", "\n}" and "\n~". 6839 6840- fix issue560: correctly display code if an "else:" or "finally:" is 6841 followed by statements on the same line. 6842 6843- Fix example in monkeypatch documentation, thanks t-8ch. 6844 6845- fix issue572: correct tmpdir doc example for python3. 6846 6847- Do not mark as universal wheel because Python 2.6 is different from 6848 other builds due to the extra argparse dependency. Fixes issue566. 6849 Thanks sontek. 6850 6851- Implement issue549: user-provided assertion messages now no longer 6852 replace the py.test introspection message but are shown in addition 6853 to them. 6854 68552.6.1 (2014-08-07) 6856================== 6857 6858- No longer show line numbers in the --verbose output, the output is now 6859 purely the nodeid. The line number is still shown in failure reports. 6860 Thanks Floris Bruynooghe. 6861 6862- fix issue437 where assertion rewriting could cause pytest-xdist worker nodes 6863 to collect different tests. Thanks Bruno Oliveira. 6864 6865- fix issue555: add "errors" attribute to capture-streams to satisfy 6866 some distutils and possibly other code accessing sys.stdout.errors. 6867 6868- fix issue547 capsys/capfd also work when output capturing ("-s") is disabled. 6869 6870- address issue170: allow pytest.mark.xfail(...) to specify expected exceptions via 6871 an optional "raises=EXC" argument where EXC can be a single exception 6872 or a tuple of exception classes. Thanks David Mohr for the complete 6873 PR. 6874 6875- fix integration of pytest with unittest.mock.patch decorator when 6876 it uses the "new" argument. Thanks Nicolas Delaby for test and PR. 6877 6878- fix issue with detecting conftest files if the arguments contain 6879 "::" node id specifications (copy pasted from "-v" output) 6880 6881- fix issue544 by only removing "@NUM" at the end of "::" separated parts 6882 and if the part has a ".py" extension 6883 6884- don't use py.std import helper, rather import things directly. 6885 Thanks Bruno Oliveira. 6886 68872.6 6888=== 6889 6890- Cache exceptions from fixtures according to their scope (issue 467). 6891 6892- fix issue537: Avoid importing old assertion reinterpretation code by default. 6893 6894- fix issue364: shorten and enhance tracebacks representation by default. 6895 The new "--tb=auto" option (default) will only display long tracebacks 6896 for the first and last entry. You can get the old behaviour of printing 6897 all entries as long entries with "--tb=long". Also short entries by 6898 default are now printed very similarly to "--tb=native" ones. 6899 6900- fix issue514: teach assertion reinterpretation about private class attributes 6901 6902- change -v output to include full node IDs of tests. Users can copy 6903 a node ID from a test run, including line number, and use it as a 6904 positional argument in order to run only a single test. 6905 6906- fix issue 475: fail early and comprehensible if calling 6907 pytest.raises with wrong exception type. 6908 6909- fix issue516: tell in getting-started about current dependencies. 6910 6911- cleanup setup.py a bit and specify supported versions. Thanks Jurko 6912 Gospodnetic for the PR. 6913 6914- change XPASS colour to yellow rather then red when tests are run 6915 with -v. 6916 6917- fix issue473: work around mock putting an unbound method into a class 6918 dict when double-patching. 6919 6920- fix issue498: if a fixture finalizer fails, make sure that 6921 the fixture is still invalidated. 6922 6923- fix issue453: the result of the pytest_assertrepr_compare hook now gets 6924 it's newlines escaped so that format_exception does not blow up. 6925 6926- internal new warning system: pytest will now produce warnings when 6927 it detects oddities in your test collection or execution. 6928 Warnings are ultimately sent to a new pytest_logwarning hook which is 6929 currently only implemented by the terminal plugin which displays 6930 warnings in the summary line and shows more details when -rw (report on 6931 warnings) is specified. 6932 6933- change skips into warnings for test classes with an __init__ and 6934 callables in test modules which look like a test but are not functions. 6935 6936- fix issue436: improved finding of initial conftest files from command 6937 line arguments by using the result of parse_known_args rather than 6938 the previous flaky heuristics. Thanks Marc Abramowitz for tests 6939 and initial fixing approaches in this area. 6940 6941- fix issue #479: properly handle nose/unittest(2) SkipTest exceptions 6942 during collection/loading of test modules. Thanks to Marc Schlaich 6943 for the complete PR. 6944 6945- fix issue490: include pytest_load_initial_conftests in documentation 6946 and improve docstring. 6947 6948- fix issue472: clarify that ``pytest.config.getvalue()`` cannot work 6949 if it's triggered ahead of command line parsing. 6950 6951- merge PR123: improved integration with mock.patch decorator on tests. 6952 6953- fix issue412: messing with stdout/stderr FD-level streams is now 6954 captured without crashes. 6955 6956- fix issue483: trial/py33 works now properly. Thanks Daniel Grana for PR. 6957 6958- improve example for pytest integration with "python setup.py test" 6959 which now has a generic "-a" or "--pytest-args" option where you 6960 can pass additional options as a quoted string. Thanks Trevor Bekolay. 6961 6962- simplified internal capturing mechanism and made it more robust 6963 against tests or setups changing FD1/FD2, also better integrated 6964 now with pytest.pdb() in single tests. 6965 6966- improvements to pytest's own test-suite leakage detection, courtesy of PRs 6967 from Marc Abramowitz 6968 6969- fix issue492: avoid leak in test_writeorg. Thanks Marc Abramowitz. 6970 6971- fix issue493: don't run tests in doc directory with ``python setup.py test`` 6972 (use tox -e doctesting for that) 6973 6974- fix issue486: better reporting and handling of early conftest loading failures 6975 6976- some cleanup and simplification of internal conftest handling. 6977 6978- work a bit harder to break reference cycles when catching exceptions. 6979 Thanks Jurko Gospodnetic. 6980 6981- fix issue443: fix skip examples to use proper comparison. Thanks Alex 6982 Groenholm. 6983 6984- support nose-style ``__test__`` attribute on modules, classes and 6985 functions, including unittest-style Classes. If set to False, the 6986 test will not be collected. 6987 6988- fix issue512: show "<notset>" for arguments which might not be set 6989 in monkeypatch plugin. Improves output in documentation. 6990 6991 69922.5.2 (2014-01-29) 6993================== 6994 6995- fix issue409 -- better interoperate with cx_freeze by not 6996 trying to import from collections.abc which causes problems 6997 for py27/cx_freeze. Thanks Wolfgang L. for reporting and tracking it down. 6998 6999- fixed docs and code to use "pytest" instead of "py.test" almost everywhere. 7000 Thanks Jurko Gospodnetic for the complete PR. 7001 7002- fix issue425: mention at end of "py.test -h" that --markers 7003 and --fixtures work according to specified test path (or current dir) 7004 7005- fix issue413: exceptions with unicode attributes are now printed 7006 correctly also on python2 and with pytest-xdist runs. (the fix 7007 requires py-1.4.20) 7008 7009- copy, cleanup and integrate py.io capture 7010 from pylib 1.4.20.dev2 (rev 13d9af95547e) 7011 7012- address issue416: clarify docs as to conftest.py loading semantics 7013 7014- fix issue429: comparing byte strings with non-ascii chars in assert 7015 expressions now work better. Thanks Floris Bruynooghe. 7016 7017- make capfd/capsys.capture private, its unused and shouldn't be exposed 7018 7019 70202.5.1 (2013-12-17) 7021================== 7022 7023- merge new documentation styling PR from Tobias Bieniek. 7024 7025- fix issue403: allow parametrize of multiple same-name functions within 7026 a collection node. Thanks Andreas Kloeckner and Alex Gaynor for reporting 7027 and analysis. 7028 7029- Allow parameterized fixtures to specify the ID of the parameters by 7030 adding an ids argument to pytest.fixture() and pytest.yield_fixture(). 7031 Thanks Floris Bruynooghe. 7032 7033- fix issue404 by always using the binary xml escape in the junitxml 7034 plugin. Thanks Ronny Pfannschmidt. 7035 7036- fix issue407: fix addoption docstring to point to argparse instead of 7037 optparse. Thanks Daniel D. Wright. 7038 7039 7040 70412.5.0 (2013-12-12) 7042================== 7043 7044- dropped python2.5 from automated release testing of pytest itself 7045 which means it's probably going to break soon (but still works 7046 with this release we believe). 7047 7048- simplified and fixed implementation for calling finalizers when 7049 parametrized fixtures or function arguments are involved. finalization 7050 is now performed lazily at setup time instead of in the "teardown phase". 7051 While this might sound odd at first, it helps to ensure that we are 7052 correctly handling setup/teardown even in complex code. User-level code 7053 should not be affected unless it's implementing the pytest_runtest_teardown 7054 hook and expecting certain fixture instances are torn down within (very 7055 unlikely and would have been unreliable anyway). 7056 7057- PR90: add --color=yes|no|auto option to force terminal coloring 7058 mode ("auto" is default). Thanks Marc Abramowitz. 7059 7060- fix issue319 - correctly show unicode in assertion errors. Many 7061 thanks to Floris Bruynooghe for the complete PR. Also means 7062 we depend on py>=1.4.19 now. 7063 7064- fix issue396 - correctly sort and finalize class-scoped parametrized 7065 tests independently from number of methods on the class. 7066 7067- refix issue323 in a better way -- parametrization should now never 7068 cause Runtime Recursion errors because the underlying algorithm 7069 for re-ordering tests per-scope/per-fixture is not recursive 7070 anymore (it was tail-call recursive before which could lead 7071 to problems for more than >966 non-function scoped parameters). 7072 7073- fix issue290 - there is preliminary support now for parametrizing 7074 with repeated same values (sometimes useful to test if calling 7075 a second time works as with the first time). 7076 7077- close issue240 - document precisely how pytest module importing 7078 works, discuss the two common test directory layouts, and how it 7079 interacts with PEP420-namespace packages. 7080 7081- fix issue246 fix finalizer order to be LIFO on independent fixtures 7082 depending on a parametrized higher-than-function scoped fixture. 7083 (was quite some effort so please bear with the complexity of this sentence :) 7084 Thanks Ralph Schmitt for the precise failure example. 7085 7086- fix issue244 by implementing special index for parameters to only use 7087 indices for paramentrized test ids 7088 7089- fix issue287 by running all finalizers but saving the exception 7090 from the first failing finalizer and re-raising it so teardown will 7091 still have failed. We reraise the first failing exception because 7092 it might be the cause for other finalizers to fail. 7093 7094- fix ordering when mock.patch or other standard decorator-wrappings 7095 are used with test methods. This fixues issue346 and should 7096 help with random "xdist" collection failures. Thanks to 7097 Ronny Pfannschmidt and Donald Stufft for helping to isolate it. 7098 7099- fix issue357 - special case "-k" expressions to allow for 7100 filtering with simple strings that are not valid python expressions. 7101 Examples: "-k 1.3" matches all tests parametrized with 1.3. 7102 "-k None" filters all tests that have "None" in their name 7103 and conversely "-k 'not None'". 7104 Previously these examples would raise syntax errors. 7105 7106- fix issue384 by removing the trial support code 7107 since the unittest compat enhancements allow 7108 trial to handle it on its own 7109 7110- don't hide an ImportError when importing a plugin produces one. 7111 fixes issue375. 7112 7113- fix issue275 - allow usefixtures and autouse fixtures 7114 for running doctest text files. 7115 7116- fix issue380 by making --resultlog only rely on longrepr instead 7117 of the "reprcrash" attribute which only exists sometimes. 7118 7119- address issue122: allow @pytest.fixture(params=iterator) by exploding 7120 into a list early on. 7121 7122- fix pexpect-3.0 compatibility for pytest's own tests. 7123 (fixes issue386) 7124 7125- allow nested parametrize-value markers, thanks James Lan for the PR. 7126 7127- fix unicode handling with new monkeypatch.setattr(import_path, value) 7128 API. Thanks Rob Dennis. Fixes issue371. 7129 7130- fix unicode handling with junitxml, fixes issue368. 7131 7132- In assertion rewriting mode on Python 2, fix the detection of coding 7133 cookies. See issue #330. 7134 7135- make "--runxfail" turn imperative pytest.xfail calls into no ops 7136 (it already did neutralize pytest.mark.xfail markers) 7137 7138- refine pytest / pkg_resources interactions: The AssertionRewritingHook 7139 PEP302 compliant loader now registers itself with setuptools/pkg_resources 7140 properly so that the pkg_resources.resource_stream method works properly. 7141 Fixes issue366. Thanks for the investigations and full PR to Jason R. Coombs. 7142 7143- pytestconfig fixture is now session-scoped as it is the same object during the 7144 whole test run. Fixes issue370. 7145 7146- avoid one surprising case of marker malfunction/confusion:: 7147 7148 @pytest.mark.some(lambda arg: ...) 7149 def test_function(): 7150 7151 would not work correctly because pytest assumes @pytest.mark.some 7152 gets a function to be decorated already. We now at least detect if this 7153 arg is a lambda and thus the example will work. Thanks Alex Gaynor 7154 for bringing it up. 7155 7156- xfail a test on pypy that checks wrong encoding/ascii (pypy does 7157 not error out). fixes issue385. 7158 7159- internally make varnames() deal with classes's __init__, 7160 although it's not needed by pytest itself atm. Also 7161 fix caching. Fixes issue376. 7162 7163- fix issue221 - handle importing of namespace-package with no 7164 __init__.py properly. 7165 7166- refactor internal FixtureRequest handling to avoid monkeypatching. 7167 One of the positive user-facing effects is that the "request" object 7168 can now be used in closures. 7169 7170- fixed version comparison in pytest.importskip(modname, minverstring) 7171 7172- fix issue377 by clarifying in the nose-compat docs that pytest 7173 does not duplicate the unittest-API into the "plain" namespace. 7174 7175- fix verbose reporting for @mock'd test functions 7176 71772.4.2 (2013-10-04) 7178================== 7179 7180- on Windows require colorama and a newer py lib so that py.io.TerminalWriter() 7181 now uses colorama instead of its own ctypes hacks. (fixes issue365) 7182 thanks Paul Moore for bringing it up. 7183 7184- fix "-k" matching of tests where "repr" and "attr" and other names would 7185 cause wrong matches because of an internal implementation quirk 7186 (don't ask) which is now properly implemented. fixes issue345. 7187 7188- avoid tmpdir fixture to create too long filenames especially 7189 when parametrization is used (issue354) 7190 7191- fix pytest-pep8 and pytest-flakes / pytest interactions 7192 (collection names in mark plugin was assuming an item always 7193 has a function which is not true for those plugins etc.) 7194 Thanks Andi Zeidler. 7195 7196- introduce node.get_marker/node.add_marker API for plugins 7197 like pytest-pep8 and pytest-flakes to avoid the messy 7198 details of the node.keywords pseudo-dicts. Adapted 7199 docs. 7200 7201- remove attempt to "dup" stdout at startup as it's icky. 7202 the normal capturing should catch enough possibilities 7203 of tests messing up standard FDs. 7204 7205- add pluginmanager.do_configure(config) as a link to 7206 config.do_configure() for plugin-compatibility 7207 72082.4.1 (2013-10-02) 7209================== 7210 7211- When using parser.addoption() unicode arguments to the 7212 "type" keyword should also be converted to the respective types. 7213 thanks Floris Bruynooghe, @dnozay. (fixes issue360 and issue362) 7214 7215- fix dotted filename completion when using argcomplete 7216 thanks Anthon van der Neuth. (fixes issue361) 7217 7218- fix regression when a 1-tuple ("arg",) is used for specifying 7219 parametrization (the values of the parametrization were passed 7220 nested in a tuple). Thanks Donald Stufft. 7221 7222- merge doc typo fixes, thanks Andy Dirnberger 7223 72242.4 7225=== 7226 7227known incompatibilities: 7228 7229- if calling --genscript from python2.7 or above, you only get a 7230 standalone script which works on python2.7 or above. Use Python2.6 7231 to also get a python2.5 compatible version. 7232 7233- all xunit-style teardown methods (nose-style, pytest-style, 7234 unittest-style) will not be called if the corresponding setup method failed, 7235 see issue322 below. 7236 7237- the pytest_plugin_unregister hook wasn't ever properly called 7238 and there is no known implementation of the hook - so it got removed. 7239 7240- pytest.fixture-decorated functions cannot be generators (i.e. use 7241 yield) anymore. This change might be reversed in 2.4.1 if it causes 7242 unforeseen real-life issues. However, you can always write and return 7243 an inner function/generator and change the fixture consumer to iterate 7244 over the returned generator. This change was done in lieu of the new 7245 ``pytest.yield_fixture`` decorator, see below. 7246 7247new features: 7248 7249- experimentally introduce a new ``pytest.yield_fixture`` decorator 7250 which accepts exactly the same parameters as pytest.fixture but 7251 mandates a ``yield`` statement instead of a ``return statement`` from 7252 fixture functions. This allows direct integration with "with-style" 7253 context managers in fixture functions and generally avoids registering 7254 of finalization callbacks in favour of treating the "after-yield" as 7255 teardown code. Thanks Andreas Pelme, Vladimir Keleshev, Floris 7256 Bruynooghe, Ronny Pfannschmidt and many others for discussions. 7257 7258- allow boolean expression directly with skipif/xfail 7259 if a "reason" is also specified. Rework skipping documentation 7260 to recommend "condition as booleans" because it prevents surprises 7261 when importing markers between modules. Specifying conditions 7262 as strings will remain fully supported. 7263 7264- reporting: color the last line red or green depending if 7265 failures/errors occurred or everything passed. thanks Christian 7266 Theunert. 7267 7268- make "import pdb ; pdb.set_trace()" work natively wrt capturing (no 7269 "-s" needed anymore), making ``pytest.set_trace()`` a mere shortcut. 7270 7271- fix issue181: --pdb now also works on collect errors (and 7272 on internal errors) . This was implemented by a slight internal 7273 refactoring and the introduction of a new hook 7274 ``pytest_exception_interact`` hook (see next item). 7275 7276- fix issue341: introduce new experimental hook for IDEs/terminals to 7277 intercept debugging: ``pytest_exception_interact(node, call, report)``. 7278 7279- new monkeypatch.setattr() variant to provide a shorter 7280 invocation for patching out classes/functions from modules: 7281 7282 monkeypatch.setattr("requests.get", myfunc) 7283 7284 will replace the "get" function of the "requests" module with ``myfunc``. 7285 7286- fix issue322: tearDownClass is not run if setUpClass failed. Thanks 7287 Mathieu Agopian for the initial fix. Also make all of pytest/nose 7288 finalizer mimic the same generic behaviour: if a setupX exists and 7289 fails, don't run teardownX. This internally introduces a new method 7290 "node.addfinalizer()" helper which can only be called during the setup 7291 phase of a node. 7292 7293- simplify pytest.mark.parametrize() signature: allow to pass a 7294 CSV-separated string to specify argnames. For example: 7295 ``pytest.mark.parametrize("input,expected", [(1,2), (2,3)])`` 7296 works as well as the previous: 7297 ``pytest.mark.parametrize(("input", "expected"), ...)``. 7298 7299- add support for setUpModule/tearDownModule detection, thanks Brian Okken. 7300 7301- integrate tab-completion on options through use of "argcomplete". 7302 Thanks Anthon van der Neut for the PR. 7303 7304- change option names to be hyphen-separated long options but keep the 7305 old spelling backward compatible. py.test -h will only show the 7306 hyphenated version, for example "--collect-only" but "--collectonly" 7307 will remain valid as well (for backward-compat reasons). Many thanks to 7308 Anthon van der Neut for the implementation and to Hynek Schlawack for 7309 pushing us. 7310 7311- fix issue 308 - allow to mark/xfail/skip individual parameter sets 7312 when parametrizing. Thanks Brianna Laugher. 7313 7314- call new experimental pytest_load_initial_conftests hook to allow 7315 3rd party plugins to do something before a conftest is loaded. 7316 7317Bug fixes: 7318 7319- fix issue358 - capturing options are now parsed more properly 7320 by using a new parser.parse_known_args method. 7321 7322- pytest now uses argparse instead of optparse (thanks Anthon) which 7323 means that "argparse" is added as a dependency if installing into python2.6 7324 environments or below. 7325 7326- fix issue333: fix a case of bad unittest/pytest hook interaction. 7327 7328- PR27: correctly handle nose.SkipTest during collection. Thanks 7329 Antonio Cuni, Ronny Pfannschmidt. 7330 7331- fix issue355: junitxml puts name="pytest" attribute to testsuite tag. 7332 7333- fix issue336: autouse fixture in plugins should work again. 7334 7335- fix issue279: improve object comparisons on assertion failure 7336 for standard datatypes and recognise collections.abc. Thanks to 7337 Brianna Laugher and Mathieu Agopian. 7338 7339- fix issue317: assertion rewriter support for the is_package method 7340 7341- fix issue335: document py.code.ExceptionInfo() object returned 7342 from pytest.raises(), thanks Mathieu Agopian. 7343 7344- remove implicit distribute_setup support from setup.py. 7345 7346- fix issue305: ignore any problems when writing pyc files. 7347 7348- SO-17664702: call fixture finalizers even if the fixture function 7349 partially failed (finalizers would not always be called before) 7350 7351- fix issue320 - fix class scope for fixtures when mixed with 7352 module-level functions. Thanks Anatloy Bubenkoff. 7353 7354- you can specify "-q" or "-qq" to get different levels of "quieter" 7355 reporting (thanks Katarzyna Jachim) 7356 7357- fix issue300 - Fix order of conftest loading when starting py.test 7358 in a subdirectory. 7359 7360- fix issue323 - sorting of many module-scoped arg parametrizations 7361 7362- make sessionfinish hooks execute with the same cwd-context as at 7363 session start (helps fix plugin behaviour which write output files 7364 with relative path such as pytest-cov) 7365 7366- fix issue316 - properly reference collection hooks in docs 7367 7368- fix issue 306 - cleanup of -k/-m options to only match markers/test 7369 names/keywords respectively. Thanks Wouter van Ackooy. 7370 7371- improved doctest counting for doctests in python modules -- 7372 files without any doctest items will not show up anymore 7373 and doctest examples are counted as separate test items. 7374 thanks Danilo Bellini. 7375 7376- fix issue245 by depending on the released py-1.4.14 7377 which fixes py.io.dupfile to work with files with no 7378 mode. Thanks Jason R. Coombs. 7379 7380- fix junitxml generation when test output contains control characters, 7381 addressing issue267, thanks Jaap Broekhuizen 7382 7383- fix issue338: honor --tb style for setup/teardown errors as well. Thanks Maho. 7384 7385- fix issue307 - use yaml.safe_load in example, thanks Mark Eichin. 7386 7387- better parametrize error messages, thanks Brianna Laugher 7388 7389- pytest_terminal_summary(terminalreporter) hooks can now use 7390 ".section(title)" and ".line(msg)" methods to print extra 7391 information at the end of a test run. 7392 73932.3.5 (2013-04-30) 7394================== 7395 7396- fix issue169: respect --tb=style with setup/teardown errors as well. 7397 7398- never consider a fixture function for test function collection 7399 7400- allow re-running of test items / helps to fix pytest-reruntests plugin 7401 and also help to keep less fixture/resource references alive 7402 7403- put captured stdout/stderr into junitxml output even for passing tests 7404 (thanks Adam Goucher) 7405 7406- Issue 265 - integrate nose setup/teardown with setupstate 7407 so it doesn't try to teardown if it did not setup 7408 7409- issue 271 - don't write junitxml on worker nodes 7410 7411- Issue 274 - don't try to show full doctest example 7412 when doctest does not know the example location 7413 7414- issue 280 - disable assertion rewriting on buggy CPython 2.6.0 7415 7416- inject "getfixture()" helper to retrieve fixtures from doctests, 7417 thanks Andreas Zeidler 7418 7419- issue 259 - when assertion rewriting, be consistent with the default 7420 source encoding of ASCII on Python 2 7421 7422- issue 251 - report a skip instead of ignoring classes with init 7423 7424- issue250 unicode/str mixes in parametrization names and values now works 7425 7426- issue257, assertion-triggered compilation of source ending in a 7427 comment line doesn't blow up in python2.5 (fixed through py>=1.4.13.dev6) 7428 7429- fix --genscript option to generate standalone scripts that also 7430 work with python3.3 (importer ordering) 7431 7432- issue171 - in assertion rewriting, show the repr of some 7433 global variables 7434 7435- fix option help for "-k" 7436 7437- move long description of distribution into README.rst 7438 7439- improve docstring for metafunc.parametrize() 7440 7441- fix bug where using capsys with pytest.set_trace() in a test 7442 function would break when looking at capsys.readouterr() 7443 7444- allow to specify prefixes starting with "_" when 7445 customizing python_functions test discovery. (thanks Graham Horler) 7446 7447- improve PYTEST_DEBUG tracing output by putting 7448 extra data on a new lines with additional indent 7449 7450- ensure OutcomeExceptions like skip/fail have initialized exception attributes 7451 7452- issue 260 - don't use nose special setup on plain unittest cases 7453 7454- fix issue134 - print the collect errors that prevent running specified test items 7455 7456- fix issue266 - accept unicode in MarkEvaluator expressions 7457 74582.3.4 (2012-11-20) 7459================== 7460 7461- yielded test functions will now have autouse-fixtures active but 7462 cannot accept fixtures as funcargs - it's anyway recommended to 7463 rather use the post-2.0 parametrize features instead of yield, see: 7464 http://pytest.org/en/stable/example/parametrize.html 7465- fix autouse-issue where autouse-fixtures would not be discovered 7466 if defined in an a/conftest.py file and tests in a/tests/test_some.py 7467- fix issue226 - LIFO ordering for fixture teardowns 7468- fix issue224 - invocations with >256 char arguments now work 7469- fix issue91 - add/discuss package/directory level setups in example 7470- allow to dynamically define markers via 7471 item.keywords[...]=assignment integrating with "-m" option 7472- make "-k" accept an expressions the same as with "-m" so that one 7473 can write: -k "name1 or name2" etc. This is a slight incompatibility 7474 if you used special syntax like "TestClass.test_method" which you now 7475 need to write as -k "TestClass and test_method" to match a certain 7476 method in a certain test class. 7477 74782.3.3 (2012-11-06) 7479================== 7480 7481- fix issue214 - parse modules that contain special objects like e. g. 7482 flask's request object which blows up on getattr access if no request 7483 is active. thanks Thomas Waldmann. 7484 7485- fix issue213 - allow to parametrize with values like numpy arrays that 7486 do not support an __eq__ operator 7487 7488- fix issue215 - split test_python.org into multiple files 7489 7490- fix issue148 - @unittest.skip on classes is now recognized and avoids 7491 calling setUpClass/tearDownClass, thanks Pavel Repin 7492 7493- fix issue209 - reintroduce python2.4 support by depending on newer 7494 pylib which re-introduced statement-finding for pre-AST interpreters 7495 7496- nose support: only call setup if it's a callable, thanks Andrew 7497 Taumoefolau 7498 7499- fix issue219 - add py2.4-3.3 classifiers to TROVE list 7500 7501- in tracebacks *,** arg values are now shown next to normal arguments 7502 (thanks Manuel Jacob) 7503 7504- fix issue217 - support mock.patch with pytest's fixtures - note that 7505 you need either mock-1.0.1 or the python3.3 builtin unittest.mock. 7506 7507- fix issue127 - improve documentation for pytest_addoption() and 7508 add a ``config.getoption(name)`` helper function for consistency. 7509 75102.3.2 (2012-10-25) 7511================== 7512 7513- fix issue208 and fix issue29 use new py version to avoid long pauses 7514 when printing tracebacks in long modules 7515 7516- fix issue205 - conftests in subdirs customizing 7517 pytest_pycollect_makemodule and pytest_pycollect_makeitem 7518 now work properly 7519 7520- fix teardown-ordering for parametrized setups 7521 7522- fix issue127 - better documentation for pytest_addoption 7523 and related objects. 7524 7525- fix unittest behaviour: TestCase.runtest only called if there are 7526 test methods defined 7527 7528- improve trial support: don't collect its empty 7529 unittest.TestCase.runTest() method 7530 7531- "python setup.py test" now works with pytest itself 7532 7533- fix/improve internal/packaging related bits: 7534 7535 - exception message check of test_nose.py now passes on python33 as well 7536 7537 - issue206 - fix test_assertrewrite.py to work when a global 7538 PYTHONDONTWRITEBYTECODE=1 is present 7539 7540 - add tox.ini to pytest distribution so that ignore-dirs and others config 7541 bits are properly distributed for maintainers who run pytest-own tests 7542 75432.3.1 (2012-10-20) 7544================== 7545 7546- fix issue202 - fix regression: using "self" from fixture functions now 7547 works as expected (it's the same "self" instance that a test method 7548 which uses the fixture sees) 7549 7550- skip pexpect using tests (test_pdb.py mostly) on freebsd* systems 7551 due to pexpect not supporting it properly (hanging) 7552 7553- link to web pages from --markers output which provides help for 7554 pytest.mark.* usage. 7555 75562.3.0 (2012-10-19) 7557================== 7558 7559- fix issue202 - better automatic names for parametrized test functions 7560- fix issue139 - introduce @pytest.fixture which allows direct scoping 7561 and parametrization of funcarg factories. 7562- fix issue198 - conftest fixtures were not found on windows32 in some 7563 circumstances with nested directory structures due to path manipulation issues 7564- fix issue193 skip test functions with were parametrized with empty 7565 parameter sets 7566- fix python3.3 compat, mostly reporting bits that previously depended 7567 on dict ordering 7568- introduce re-ordering of tests by resource and parametrization setup 7569 which takes precedence to the usual file-ordering 7570- fix issue185 monkeypatching time.time does not cause pytest to fail 7571- fix issue172 duplicate call of pytest.fixture decoratored setup_module 7572 functions 7573- fix junitxml=path construction so that if tests change the 7574 current working directory and the path is a relative path 7575 it is constructed correctly from the original current working dir. 7576- fix "python setup.py test" example to cause a proper "errno" return 7577- fix issue165 - fix broken doc links and mention stackoverflow for FAQ 7578- catch unicode-issues when writing failure representations 7579 to terminal to prevent the whole session from crashing 7580- fix xfail/skip confusion: a skip-mark or an imperative pytest.skip 7581 will now take precedence before xfail-markers because we 7582 can't determine xfail/xpass status in case of a skip. see also: 7583 http://stackoverflow.com/questions/11105828/in-py-test-when-i-explicitly-skip-a-test-that-is-marked-as-xfail-how-can-i-get 7584 7585- always report installed 3rd party plugins in the header of a test run 7586 7587- fix issue160: a failing setup of an xfail-marked tests should 7588 be reported as xfail (not xpass) 7589 7590- fix issue128: show captured output when capsys/capfd are used 7591 7592- fix issue179: properly show the dependency chain of factories 7593 7594- pluginmanager.register(...) now raises ValueError if the 7595 plugin has been already registered or the name is taken 7596 7597- fix issue159: improve https://docs.pytest.org/en/6.0.1/faq.html 7598 especially with respect to the "magic" history, also mention 7599 pytest-django, trial and unittest integration. 7600 7601- make request.keywords and node.keywords writable. All descendant 7602 collection nodes will see keyword values. Keywords are dictionaries 7603 containing markers and other info. 7604 7605- fix issue 178: xml binary escapes are now wrapped in py.xml.raw 7606 7607- fix issue 176: correctly catch the builtin AssertionError 7608 even when we replaced AssertionError with a subclass on the 7609 python level 7610 7611- factory discovery no longer fails with magic global callables 7612 that provide no sane __code__ object (mock.call for example) 7613 7614- fix issue 182: testdir.inprocess_run now considers passed plugins 7615 7616- fix issue 188: ensure sys.exc_info is clear on python2 7617 before calling into a test 7618 7619- fix issue 191: add unittest TestCase runTest method support 7620- fix issue 156: monkeypatch correctly handles class level descriptors 7621 7622- reporting refinements: 7623 7624 - pytest_report_header now receives a "startdir" so that 7625 you can use startdir.bestrelpath(yourpath) to show 7626 nice relative path 7627 7628 - allow plugins to implement both pytest_report_header and 7629 pytest_sessionstart (sessionstart is invoked first). 7630 7631 - don't show deselected reason line if there is none 7632 7633 - py.test -vv will show all of assert comparisons instead of truncating 7634 76352.2.4 (2012-05-22) 7636================== 7637 7638- fix error message for rewritten assertions involving the % operator 7639- fix issue 126: correctly match all invalid xml characters for junitxml 7640 binary escape 7641- fix issue with unittest: now @unittest.expectedFailure markers should 7642 be processed correctly (you can also use @pytest.mark markers) 7643- document integration with the extended distribute/setuptools test commands 7644- fix issue 140: properly get the real functions 7645 of bound classmethods for setup/teardown_class 7646- fix issue #141: switch from the deceased paste.pocoo.org to bpaste.net 7647- fix issue #143: call unconfigure/sessionfinish always when 7648 configure/sessionstart where called 7649- fix issue #144: better mangle test ids to junitxml classnames 7650- upgrade distribute_setup.py to 0.6.27 7651 76522.2.3 (2012-02-05) 7653================== 7654 7655- fix uploaded package to only include necessary files 7656 76572.2.2 (2012-02-05) 7658================== 7659 7660- fix issue101: wrong args to unittest.TestCase test function now 7661 produce better output 7662- fix issue102: report more useful errors and hints for when a 7663 test directory was renamed and some pyc/__pycache__ remain 7664- fix issue106: allow parametrize to be applied multiple times 7665 e.g. from module, class and at function level. 7666- fix issue107: actually perform session scope finalization 7667- don't check in parametrize if indirect parameters are funcarg names 7668- add chdir method to monkeypatch funcarg 7669- fix crash resulting from calling monkeypatch undo a second time 7670- fix issue115: make --collectonly robust against early failure 7671 (missing files/directories) 7672- "-qq --collectonly" now shows only files and the number of tests in them 7673- "-q --collectonly" now shows test ids 7674- allow adding of attributes to test reports such that it also works 7675 with distributed testing (no upgrade of pytest-xdist needed) 7676 76772.2.1 (2011-12-16) 7678================== 7679 7680- fix issue99 (in pytest and py) internallerrors with resultlog now 7681 produce better output - fixed by normalizing pytest_internalerror 7682 input arguments. 7683- fix issue97 / traceback issues (in pytest and py) improve traceback output 7684 in conjunction with jinja2 and cython which hack tracebacks 7685- fix issue93 (in pytest and pytest-xdist) avoid "delayed teardowns": 7686 the final test in a test node will now run its teardown directly 7687 instead of waiting for the end of the session. Thanks Dave Hunt for 7688 the good reporting and feedback. The pytest_runtest_protocol as well 7689 as the pytest_runtest_teardown hooks now have "nextitem" available 7690 which will be None indicating the end of the test run. 7691- fix collection crash due to unknown-source collected items, thanks 7692 to Ralf Schmitt (fixed by depending on a more recent pylib) 7693 76942.2.0 (2011-11-18) 7695================== 7696 7697- fix issue90: introduce eager tearing down of test items so that 7698 teardown function are called earlier. 7699- add an all-powerful metafunc.parametrize function which allows to 7700 parametrize test function arguments in multiple steps and therefore 7701 from independent plugins and places. 7702- add a @pytest.mark.parametrize helper which allows to easily 7703 call a test function with different argument values 7704- Add examples to the "parametrize" example page, including a quick port 7705 of Test scenarios and the new parametrize function and decorator. 7706- introduce registration for "pytest.mark.*" helpers via ini-files 7707 or through plugin hooks. Also introduce a "--strict" option which 7708 will treat unregistered markers as errors 7709 allowing to avoid typos and maintain a well described set of markers 7710 for your test suite. See exaples at http://pytest.org/en/stable/mark.html 7711 and its links. 7712- issue50: introduce "-m marker" option to select tests based on markers 7713 (this is a stricter and more predictable version of '-k' in that "-m" 7714 only matches complete markers and has more obvious rules for and/or 7715 semantics. 7716- new feature to help optimizing the speed of your tests: 7717 --durations=N option for displaying N slowest test calls 7718 and setup/teardown methods. 7719- fix issue87: --pastebin now works with python3 7720- fix issue89: --pdb with unexpected exceptions in doctest work more sensibly 7721- fix and cleanup pytest's own test suite to not leak FDs 7722- fix issue83: link to generated funcarg list 7723- fix issue74: pyarg module names are now checked against imp.find_module false positives 7724- fix compatibility with twisted/trial-11.1.0 use cases 7725- simplify Node.listchain 7726- simplify junitxml output code by relying on py.xml 7727- add support for skip properties on unittest classes and functions 7728 77292.1.3 (2011-10-18) 7730================== 7731 7732- fix issue79: assertion rewriting failed on some comparisons in boolops 7733- correctly handle zero length arguments (a la pytest '') 7734- fix issue67 / junitxml now contains correct test durations, thanks ronny 7735- fix issue75 / skipping test failure on jython 7736- fix issue77 / Allow assertrepr_compare hook to apply to a subset of tests 7737 77382.1.2 (2011-09-24) 7739================== 7740 7741- fix assertion rewriting on files with windows newlines on some Python versions 7742- refine test discovery by package/module name (--pyargs), thanks Florian Mayer 7743- fix issue69 / assertion rewriting fixed on some boolean operations 7744- fix issue68 / packages now work with assertion rewriting 7745- fix issue66: use different assertion rewriting caches when the -O option is passed 7746- don't try assertion rewriting on Jython, use reinterp 7747 77482.1.1 7749===== 7750 7751- fix issue64 / pytest.set_trace now works within pytest_generate_tests hooks 7752- fix issue60 / fix error conditions involving the creation of __pycache__ 7753- fix issue63 / assertion rewriting on inserts involving strings containing '%' 7754- fix assertion rewriting on calls with a ** arg 7755- don't cache rewritten modules if bytecode generation is disabled 7756- fix assertion rewriting in read-only directories 7757- fix issue59: provide system-out/err tags for junitxml output 7758- fix issue61: assertion rewriting on boolean operations with 3 or more operands 7759- you can now build a man page with "cd doc ; make man" 7760 77612.1.0 (2011-07-09) 7762================== 7763 7764- fix issue53 call nosestyle setup functions with correct ordering 7765- fix issue58 and issue59: new assertion code fixes 7766- merge Benjamin's assertionrewrite branch: now assertions 7767 for test modules on python 2.6 and above are done by rewriting 7768 the AST and saving the pyc file before the test module is imported. 7769 see doc/assert.txt for more info. 7770- fix issue43: improve doctests with better traceback reporting on 7771 unexpected exceptions 7772- fix issue47: timing output in junitxml for test cases is now correct 7773- fix issue48: typo in MarkInfo repr leading to exception 7774- fix issue49: avoid confusing error when initizaliation partially fails 7775- fix issue44: env/username expansion for junitxml file path 7776- show releaselevel information in test runs for pypy 7777- reworked doc pages for better navigation and PDF generation 7778- report KeyboardInterrupt even if interrupted during session startup 7779- fix issue 35 - provide PDF doc version and download link from index page 7780 77812.0.3 (2011-05-11) 7782================== 7783 7784- fix issue38: nicer tracebacks on calls to hooks, particularly early 7785 configure/sessionstart ones 7786 7787- fix missing skip reason/meta information in junitxml files, reported 7788 via http://lists.idyll.org/pipermail/testing-in-python/2011-March/003928.html 7789 7790- fix issue34: avoid collection failure with "test" prefixed classes 7791 deriving from object. 7792 7793- don't require zlib (and other libs) for genscript plugin without 7794 --genscript actually being used. 7795 7796- speed up skips (by not doing a full traceback representation 7797 internally) 7798 7799- fix issue37: avoid invalid characters in junitxml's output 7800 78012.0.2 (2011-03-09) 7802================== 7803 7804- tackle issue32 - speed up test runs of very quick test functions 7805 by reducing the relative overhead 7806 7807- fix issue30 - extended xfail/skipif handling and improved reporting. 7808 If you have a syntax error in your skip/xfail 7809 expressions you now get nice error reports. 7810 7811 Also you can now access module globals from xfail/skipif 7812 expressions so that this for example works now:: 7813 7814 import pytest 7815 import mymodule 7816 @pytest.mark.skipif("mymodule.__version__[0] == "1") 7817 def test_function(): 7818 pass 7819 7820 This will not run the test function if the module's version string 7821 does not start with a "1". Note that specifying a string instead 7822 of a boolean expressions allows py.test to report meaningful information 7823 when summarizing a test run as to what conditions lead to skipping 7824 (or xfail-ing) tests. 7825 7826- fix issue28 - setup_method and pytest_generate_tests work together 7827 The setup_method fixture method now gets called also for 7828 test function invocations generated from the pytest_generate_tests 7829 hook. 7830 7831- fix issue27 - collectonly and keyword-selection (-k) now work together 7832 Also, if you do "py.test --collectonly -q" you now get a flat list 7833 of test ids that you can use to paste to the py.test commandline 7834 in order to execute a particular test. 7835 7836- fix issue25 avoid reported problems with --pdb and python3.2/encodings output 7837 7838- fix issue23 - tmpdir argument now works on Python3.2 and WindowsXP 7839 Starting with Python3.2 os.symlink may be supported. By requiring 7840 a newer py lib version the py.path.local() implementation acknowledges 7841 this. 7842 7843- fixed typos in the docs (thanks Victor Garcia, Brianna Laugher) and particular 7844 thanks to Laura Creighton who also reviewed parts of the documentation. 7845 7846- fix slightly wrong output of verbose progress reporting for classes 7847 (thanks Amaury) 7848 7849- more precise (avoiding of) deprecation warnings for node.Class|Function accesses 7850 7851- avoid std unittest assertion helper code in tracebacks (thanks Ronny) 7852 78532.0.1 (2011-02-07) 7854================== 7855 7856- refine and unify initial capturing so that it works nicely 7857 even if the logging module is used on an early-loaded conftest.py 7858 file or plugin. 7859- allow to omit "()" in test ids to allow for uniform test ids 7860 as produced by Alfredo's nice pytest.vim plugin. 7861- fix issue12 - show plugin versions with "--version" and 7862 "--traceconfig" and also document how to add extra information 7863 to reporting test header 7864- fix issue17 (import-* reporting issue on python3) by 7865 requiring py>1.4.0 (1.4.1 is going to include it) 7866- fix issue10 (numpy arrays truth checking) by refining 7867 assertion interpretation in py lib 7868- fix issue15: make nose compatibility tests compatible 7869 with python3 (now that nose-1.0 supports python3) 7870- remove somewhat surprising "same-conftest" detection because 7871 it ignores conftest.py when they appear in several subdirs. 7872- improve assertions ("not in"), thanks Floris Bruynooghe 7873- improve behaviour/warnings when running on top of "python -OO" 7874 (assertions and docstrings are turned off, leading to potential 7875 false positives) 7876- introduce a pytest_cmdline_processargs(args) hook 7877 to allow dynamic computation of command line arguments. 7878 This fixes a regression because py.test prior to 2.0 7879 allowed to set command line options from conftest.py 7880 files which so far pytest-2.0 only allowed from ini-files now. 7881- fix issue7: assert failures in doctest modules. 7882 unexpected failures in doctests will not generally 7883 show nicer, i.e. within the doctest failing context. 7884- fix issue9: setup/teardown functions for an xfail-marked 7885 test will report as xfail if they fail but report as normally 7886 passing (not xpassing) if they succeed. This only is true 7887 for "direct" setup/teardown invocations because teardown_class/ 7888 teardown_module cannot closely relate to a single test. 7889- fix issue14: no logging errors at process exit 7890- refinements to "collecting" output on non-ttys 7891- refine internal plugin registration and --traceconfig output 7892- introduce a mechanism to prevent/unregister plugins from the 7893 command line, see http://pytest.org/en/stable/plugins.html#cmdunregister 7894- activate resultlog plugin by default 7895- fix regression wrt yielded tests which due to the 7896 collection-before-running semantics were not 7897 setup as with pytest 1.3.4. Note, however, that 7898 the recommended and much cleaner way to do test 7899 parametraization remains the "pytest_generate_tests" 7900 mechanism, see the docs. 7901 79022.0.0 (2010-11-25) 7903================== 7904 7905- pytest-2.0 is now its own package and depends on pylib-2.0 7906- new ability: python -m pytest / python -m pytest.main ability 7907- new python invocation: pytest.main(args, plugins) to load 7908 some custom plugins early. 7909- try harder to run unittest test suites in a more compatible manner 7910 by deferring setup/teardown semantics to the unittest package. 7911 also work harder to run twisted/trial and Django tests which 7912 should now basically work by default. 7913- introduce a new way to set config options via ini-style files, 7914 by default setup.cfg and tox.ini files are searched. The old 7915 ways (certain environment variables, dynamic conftest.py reading 7916 is removed). 7917- add a new "-q" option which decreases verbosity and prints a more 7918 nose/unittest-style "dot" output. 7919- fix issue135 - marks now work with unittest test cases as well 7920- fix issue126 - introduce py.test.set_trace() to trace execution via 7921 PDB during the running of tests even if capturing is ongoing. 7922- fix issue123 - new "python -m py.test" invocation for py.test 7923 (requires Python 2.5 or above) 7924- fix issue124 - make reporting more resilient against tests opening 7925 files on filedescriptor 1 (stdout). 7926- fix issue109 - sibling conftest.py files will not be loaded. 7927 (and Directory collectors cannot be customized anymore from a Directory's 7928 conftest.py - this needs to happen at least one level up). 7929- introduce (customizable) assertion failure representations and enhance 7930 output on assertion failures for comparisons and other cases (Floris Bruynooghe) 7931- nose-plugin: pass through type-signature failures in setup/teardown 7932 functions instead of not calling them (Ed Singleton) 7933- remove py.test.collect.Directory (follows from a major refactoring 7934 and simplification of the collection process) 7935- majorly reduce py.test core code, shift function/python testing to own plugin 7936- fix issue88 (finding custom test nodes from command line arg) 7937- refine 'tmpdir' creation, will now create basenames better associated 7938 with test names (thanks Ronny) 7939- "xpass" (unexpected pass) tests don't cause exitcode!=0 7940- fix issue131 / issue60 - importing doctests in __init__ files used as namespace packages 7941- fix issue93 stdout/stderr is captured while importing conftest.py 7942- fix bug: unittest collected functions now also can have "pytestmark" 7943 applied at class/module level 7944- add ability to use "class" level for cached_setup helper 7945- fix strangeness: mark.* objects are now immutable, create new instances 7946 79471.3.4 (2010-09-14) 7948================== 7949 7950- fix issue111: improve install documentation for windows 7951- fix issue119: fix custom collectability of __init__.py as a module 7952- fix issue116: --doctestmodules work with __init__.py files as well 7953- fix issue115: unify internal exception passthrough/catching/GeneratorExit 7954- fix issue118: new --tb=native for presenting cpython-standard exceptions 7955 79561.3.3 (2010-07-30) 7957================== 7958 7959- fix issue113: assertion representation problem with triple-quoted strings 7960 (and possibly other cases) 7961- make conftest loading detect that a conftest file with the same 7962 content was already loaded, avoids surprises in nested directory structures 7963 which can be produced e.g. by Hudson. It probably removes the need to use 7964 --confcutdir in most cases. 7965- fix terminal coloring for win32 7966 (thanks Michael Foord for reporting) 7967- fix weirdness: make terminal width detection work on stdout instead of stdin 7968 (thanks Armin Ronacher for reporting) 7969- remove trailing whitespace in all py/text distribution files 7970 79711.3.2 (2010-07-08) 7972================== 7973 7974**New features** 7975 7976- fix issue103: introduce py.test.raises as context manager, examples:: 7977 7978 with py.test.raises(ZeroDivisionError): 7979 x = 0 7980 1 / x 7981 7982 with py.test.raises(RuntimeError) as excinfo: 7983 call_something() 7984 7985 # you may do extra checks on excinfo.value|type|traceback here 7986 7987 (thanks Ronny Pfannschmidt) 7988 7989- Funcarg factories can now dynamically apply a marker to a 7990 test invocation. This is for example useful if a factory 7991 provides parameters to a test which are expected-to-fail:: 7992 7993 def pytest_funcarg__arg(request): 7994 request.applymarker(py.test.mark.xfail(reason="flaky config")) 7995 ... 7996 7997 def test_function(arg): 7998 ... 7999 8000- improved error reporting on collection and import errors. This makes 8001 use of a more general mechanism, namely that for custom test item/collect 8002 nodes ``node.repr_failure(excinfo)`` is now uniformly called so that you can 8003 override it to return a string error representation of your choice 8004 which is going to be reported as a (red) string. 8005 8006- introduce '--junitprefix=STR' option to prepend a prefix 8007 to all reports in the junitxml file. 8008 8009**Bug fixes** 8010 8011- make tests and the ``pytest_recwarn`` plugin in particular fully compatible 8012 to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that 8013 you can properly check for their existence in a cross-python manner). 8014- refine --pdb: ignore xfailed tests, unify its TB-reporting and 8015 don't display failures again at the end. 8016- fix assertion interpretation with the ** operator (thanks Benjamin Peterson) 8017- fix issue105 assignment on the same line as a failing assertion (thanks Benjamin Peterson) 8018- fix issue104 proper escaping for test names in junitxml plugin (thanks anonymous) 8019- fix issue57 -f|--looponfail to work with xpassing tests (thanks Ronny) 8020- fix issue92 collectonly reporter and --pastebin (thanks Benjamin Peterson) 8021- fix py.code.compile(source) to generate unique filenames 8022- fix assertion re-interp problems on PyPy, by defering code 8023 compilation to the (overridable) Frame.eval class. (thanks Amaury Forgeot) 8024- fix py.path.local.pyimport() to work with directories 8025- streamline py.path.local.mkdtemp implementation and usage 8026- don't print empty lines when showing junitxml-filename 8027- add optional boolean ignore_errors parameter to py.path.local.remove 8028- fix terminal writing on win32/python2.4 8029- py.process.cmdexec() now tries harder to return properly encoded unicode objects 8030 on all python versions 8031- install plain py.test/py.which scripts also for Jython, this helps to 8032 get canonical script paths in virtualenv situations 8033- make path.bestrelpath(path) return ".", note that when calling 8034 X.bestrelpath the assumption is that X is a directory. 8035- make initial conftest discovery ignore "--" prefixed arguments 8036- fix resultlog plugin when used in a multicpu/multihost xdist situation 8037 (thanks Jakub Gustak) 8038- perform distributed testing related reporting in the xdist-plugin 8039 rather than having dist-related code in the generic py.test 8040 distribution 8041- fix homedir detection on Windows 8042- ship distribute_setup.py version 0.6.13 8043 80441.3.1 (2010-05-25) 8045================== 8046 8047**New features** 8048 8049- issue91: introduce new py.test.xfail(reason) helper 8050 to imperatively mark a test as expected to fail. Can 8051 be used from within setup and test functions. This is 8052 useful especially for parametrized tests when certain 8053 configurations are expected-to-fail. In this case the 8054 declarative approach with the @py.test.mark.xfail cannot 8055 be used as it would mark all configurations as xfail. 8056 8057- issue102: introduce new --maxfail=NUM option to stop 8058 test runs after NUM failures. This is a generalization 8059 of the '-x' or '--exitfirst' option which is now equivalent 8060 to '--maxfail=1'. Both '-x' and '--maxfail' will 8061 now also print a line near the end indicating the Interruption. 8062 8063- issue89: allow py.test.mark decorators to be used on classes 8064 (class decorators were introduced with python2.6) and 8065 also allow to have multiple markers applied at class/module level 8066 by specifying a list. 8067 8068- improve and refine letter reporting in the progress bar: 8069 . pass 8070 f failed test 8071 s skipped tests (reminder: use for dependency/platform mismatch only) 8072 x xfailed test (test that was expected to fail) 8073 X xpassed test (test that was expected to fail but passed) 8074 8075 You can use any combination of 'fsxX' with the '-r' extended 8076 reporting option. The xfail/xpass results will show up as 8077 skipped tests in the junitxml output - which also fixes 8078 issue99. 8079 8080- make py.test.cmdline.main() return the exitstatus instead of raising 8081 SystemExit and also allow it to be called multiple times. This of 8082 course requires that your application and tests are properly teared 8083 down and don't have global state. 8084 8085**Bug Fixes** 8086 8087- improved traceback presentation: 8088 - improved and unified reporting for "--tb=short" option 8089 - Errors during test module imports are much shorter, (using --tb=short style) 8090 - raises shows shorter more relevant tracebacks 8091 - --fulltrace now more systematically makes traces longer / inhibits cutting 8092 8093- improve support for raises and other dynamically compiled code by 8094 manipulating python's linecache.cache instead of the previous 8095 rather hacky way of creating custom code objects. This makes 8096 it seemlessly work on Jython and PyPy where it previously didn't. 8097 8098- fix issue96: make capturing more resilient against Control-C 8099 interruptions (involved somewhat substantial refactoring 8100 to the underlying capturing functionality to avoid race 8101 conditions). 8102 8103- fix chaining of conditional skipif/xfail decorators - so it works now 8104 as expected to use multiple @py.test.mark.skipif(condition) decorators, 8105 including specific reporting which of the conditions lead to skipping. 8106 8107- fix issue95: late-import zlib so that it's not required 8108 for general py.test startup. 8109 8110- fix issue94: make reporting more robust against bogus source code 8111 (and internally be more careful when presenting unexpected byte sequences) 8112 8113 81141.3.0 (2010-05-05) 8115================== 8116 8117- deprecate --report option in favour of a new shorter and easier to 8118 remember -r option: it takes a string argument consisting of any 8119 combination of 'xfsX' characters. They relate to the single chars 8120 you see during the dotted progress printing and will print an extra line 8121 per test at the end of the test run. This extra line indicates the exact 8122 position or test ID that you directly paste to the py.test cmdline in order 8123 to re-run a particular test. 8124 8125- allow external plugins to register new hooks via the new 8126 pytest_addhooks(pluginmanager) hook. The new release of 8127 the pytest-xdist plugin for distributed and looponfailing 8128 testing requires this feature. 8129 8130- add a new pytest_ignore_collect(path, config) hook to allow projects and 8131 plugins to define exclusion behaviour for their directory structure - 8132 for example you may define in a conftest.py this method:: 8133 8134 def pytest_ignore_collect(path): 8135 return path.check(link=1) 8136 8137 to prevent even a collection try of any tests in symlinked dirs. 8138 8139- new pytest_pycollect_makemodule(path, parent) hook for 8140 allowing customization of the Module collection object for a 8141 matching test module. 8142 8143- extend and refine xfail mechanism: 8144 ``@py.test.mark.xfail(run=False)`` do not run the decorated test 8145 ``@py.test.mark.xfail(reason="...")`` prints the reason string in xfail summaries 8146 specifying ``--runxfail`` on command line virtually ignores xfail markers 8147 8148- expose (previously internal) commonly useful methods: 8149 py.io.get_terminal_with() -> return terminal width 8150 py.io.ansi_print(...) -> print colored/bold text on linux/win32 8151 py.io.saferepr(obj) -> return limited representation string 8152 8153- expose test outcome related exceptions as py.test.skip.Exception, 8154 py.test.raises.Exception etc., useful mostly for plugins 8155 doing special outcome interpretation/tweaking 8156 8157- (issue85) fix junitxml plugin to handle tests with non-ascii output 8158 8159- fix/refine python3 compatibility (thanks Benjamin Peterson) 8160 8161- fixes for making the jython/win32 combination work, note however: 8162 jython2.5.1/win32 does not provide a command line launcher, see 8163 http://bugs.jython.org/issue1491 . See pylib install documentation 8164 for how to work around. 8165 8166- fixes for handling of unicode exception values and unprintable objects 8167 8168- (issue87) fix unboundlocal error in assertionold code 8169 8170- (issue86) improve documentation for looponfailing 8171 8172- refine IO capturing: stdin-redirect pseudo-file now has a NOP close() method 8173 8174- ship distribute_setup.py version 0.6.10 8175 8176- added links to the new capturelog and coverage plugins 8177 8178 81791.2.0 (2010-01-18) 8180================== 8181 8182- refined usage and options for "py.cleanup":: 8183 8184 py.cleanup # remove "*.pyc" and "*$py.class" (jython) files 8185 py.cleanup -e .swp -e .cache # also remove files with these extensions 8186 py.cleanup -s # remove "build" and "dist" directory next to setup.py files 8187 py.cleanup -d # also remove empty directories 8188 py.cleanup -a # synonym for "-s -d -e 'pip-log.txt'" 8189 py.cleanup -n # dry run, only show what would be removed 8190 8191- add a new option "py.test --funcargs" which shows available funcargs 8192 and their help strings (docstrings on their respective factory function) 8193 for a given test path 8194 8195- display a short and concise traceback if a funcarg lookup fails 8196 8197- early-load "conftest.py" files in non-dot first-level sub directories. 8198 allows to conveniently keep and access test-related options in a ``test`` 8199 subdir and still add command line options. 8200 8201- fix issue67: new super-short traceback-printing option: "--tb=line" will print a single line for each failing (python) test indicating its filename, lineno and the failure value 8202 8203- fix issue78: always call python-level teardown functions even if the 8204 according setup failed. This includes refinements for calling setup_module/class functions 8205 which will now only be called once instead of the previous behaviour where they'd be called 8206 multiple times if they raise an exception (including a Skipped exception). Any exception 8207 will be re-corded and associated with all tests in the according module/class scope. 8208 8209- fix issue63: assume <40 columns to be a bogus terminal width, default to 80 8210 8211- fix pdb debugging to be in the correct frame on raises-related errors 8212 8213- update apipkg.py to fix an issue where recursive imports might 8214 unnecessarily break importing 8215 8216- fix plugin links 8217 82181.1.1 (2009-11-24) 8219================== 8220 8221- moved dist/looponfailing from py.test core into a new 8222 separately released pytest-xdist plugin. 8223 8224- new junitxml plugin: --junitxml=path will generate a junit style xml file 8225 which is processable e.g. by the Hudson CI system. 8226 8227- new option: --genscript=path will generate a standalone py.test script 8228 which will not need any libraries installed. thanks to Ralf Schmitt. 8229 8230- new option: --ignore will prevent specified path from collection. 8231 Can be specified multiple times. 8232 8233- new option: --confcutdir=dir will make py.test only consider conftest 8234 files that are relative to the specified dir. 8235 8236- new funcarg: "pytestconfig" is the pytest config object for access 8237 to command line args and can now be easily used in a test. 8238 8239- install ``py.test`` and ``py.which`` with a ``-$VERSION`` suffix to 8240 disambiguate between Python3, python2.X, Jython and PyPy installed versions. 8241 8242- new "pytestconfig" funcarg allows access to test config object 8243 8244- new "pytest_report_header" hook can return additional lines 8245 to be displayed at the header of a test run. 8246 8247- (experimental) allow "py.test path::name1::name2::..." for pointing 8248 to a test within a test collection directly. This might eventually 8249 evolve as a full substitute to "-k" specifications. 8250 8251- streamlined plugin loading: order is now as documented in 8252 customize.html: setuptools, ENV, commandline, conftest. 8253 also setuptools entry point names are turned to canonical names ("pytest_*") 8254 8255- automatically skip tests that need 'capfd' but have no os.dup 8256 8257- allow pytest_generate_tests to be defined in classes as well 8258 8259- deprecate usage of 'disabled' attribute in favour of pytestmark 8260- deprecate definition of Directory, Module, Class and Function nodes 8261 in conftest.py files. Use pytest collect hooks instead. 8262 8263- collection/item node specific runtest/collect hooks are only called exactly 8264 on matching conftest.py files, i.e. ones which are exactly below 8265 the filesystem path of an item 8266 8267- change: the first pytest_collect_directory hook to return something 8268 will now prevent further hooks to be called. 8269 8270- change: figleaf plugin now requires --figleaf to run. Also 8271 change its long command line options to be a bit shorter (see py.test -h). 8272 8273- change: pytest doctest plugin is now enabled by default and has a 8274 new option --doctest-glob to set a pattern for file matches. 8275 8276- change: remove internal py._* helper vars, only keep py._pydir 8277 8278- robustify capturing to survive if custom pytest_runtest_setup 8279 code failed and prevented the capturing setup code from running. 8280 8281- make py.test.* helpers provided by default plugins visible early - 8282 works transparently both for pydoc and for interactive sessions 8283 which will regularly see e.g. py.test.mark and py.test.importorskip. 8284 8285- simplify internal plugin manager machinery 8286- simplify internal collection tree by introducing a RootCollector node 8287 8288- fix assert reinterpreation that sees a call containing "keyword=..." 8289 8290- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish 8291 hooks on worker nodes during dist-testing, report module/session teardown 8292 hooks correctly. 8293 8294- fix issue65: properly handle dist-testing if no 8295 execnet/py lib installed remotely. 8296 8297- skip some install-tests if no execnet is available 8298 8299- fix docs, fix internal bin/ script generation 8300 8301 83021.1.0 (2009-11-05) 8303================== 8304 8305- introduce automatic plugin registration via 'pytest11' 8306 entrypoints via setuptools' pkg_resources.iter_entry_points 8307 8308- fix py.test dist-testing to work with execnet >= 1.0.0b4 8309 8310- re-introduce py.test.cmdline.main() for better backward compatibility 8311 8312- svn paths: fix a bug with path.check(versioned=True) for svn paths, 8313 allow '%' in svn paths, make svnwc.update() default to interactive mode 8314 like in 1.0.x and add svnwc.update(interactive=False) to inhibit interaction. 8315 8316- refine distributed tarball to contain test and no pyc files 8317 8318- try harder to have deprecation warnings for py.compat.* accesses 8319 report a correct location 8320 83211.0.3 8322===== 8323 8324* adjust and improve docs 8325 8326* remove py.rest tool and internal namespace - it was 8327 never really advertised and can still be used with 8328 the old release if needed. If there is interest 8329 it could be revived into its own tool i guess. 8330 8331* fix issue48 and issue59: raise an Error if the module 8332 from an imported test file does not seem to come from 8333 the filepath - avoids "same-name" confusion that has 8334 been reported repeatedly 8335 8336* merged Ronny's nose-compatibility hacks: now 8337 nose-style setup_module() and setup() functions are 8338 supported 8339 8340* introduce generalized py.test.mark function marking 8341 8342* reshuffle / refine command line grouping 8343 8344* deprecate parser.addgroup in favour of getgroup which creates option group 8345 8346* add --report command line option that allows to control showing of skipped/xfailed sections 8347 8348* generalized skipping: a new way to mark python functions with skipif or xfail 8349 at function, class and modules level based on platform or sys-module attributes. 8350 8351* extend py.test.mark decorator to allow for positional args 8352 8353* introduce and test "py.cleanup -d" to remove empty directories 8354 8355* fix issue #59 - robustify unittest test collection 8356 8357* make bpython/help interaction work by adding an __all__ attribute 8358 to ApiModule, cleanup initpkg 8359 8360* use MIT license for pylib, add some contributors 8361 8362* remove py.execnet code and substitute all usages with 'execnet' proper 8363 8364* fix issue50 - cached_setup now caches more to expectations 8365 for test functions with multiple arguments. 8366 8367* merge Jarko's fixes, issue #45 and #46 8368 8369* add the ability to specify a path for py.lookup to search in 8370 8371* fix a funcarg cached_setup bug probably only occurring 8372 in distributed testing and "module" scope with teardown. 8373 8374* many fixes and changes for making the code base python3 compatible, 8375 many thanks to Benjamin Peterson for helping with this. 8376 8377* consolidate builtins implementation to be compatible with >=2.3, 8378 add helpers to ease keeping 2 and 3k compatible code 8379 8380* deprecate py.compat.doctest|subprocess|textwrap|optparse 8381 8382* deprecate py.magic.autopath, remove py/magic directory 8383 8384* move pytest assertion handling to py/code and a pytest_assertion 8385 plugin, add "--no-assert" option, deprecate py.magic namespaces 8386 in favour of (less) py.code ones. 8387 8388* consolidate and cleanup py/code classes and files 8389 8390* cleanup py/misc, move tests to bin-for-dist 8391 8392* introduce delattr/delitem/delenv methods to py.test's monkeypatch funcarg 8393 8394* consolidate py.log implementation, remove old approach. 8395 8396* introduce py.io.TextIO and py.io.BytesIO for distinguishing between 8397 text/unicode and byte-streams (uses underlying standard lib io.* 8398 if available) 8399 8400* make py.unittest_convert helper script available which converts "unittest.py" 8401 style files into the simpler assert/direct-test-classes py.test/nosetests 8402 style. The script was written by Laura Creighton. 8403 8404* simplified internal localpath implementation 8405 84061.0.2 (2009-08-27) 8407================== 8408 8409* fixing packaging issues, triggered by fedora redhat packaging, 8410 also added doc, examples and contrib dirs to the tarball. 8411 8412* added a documentation link to the new django plugin. 8413 84141.0.1 (2009-08-19) 8415================== 8416 8417* added a 'pytest_nose' plugin which handles nose.SkipTest, 8418 nose-style function/method/generator setup/teardown and 8419 tries to report functions correctly. 8420 8421* capturing of unicode writes or encoded strings to sys.stdout/err 8422 work better, also terminalwriting was adapted and somewhat 8423 unified between windows and linux. 8424 8425* improved documentation layout and content a lot 8426 8427* added a "--help-config" option to show conftest.py / ENV-var names for 8428 all longopt cmdline options, and some special conftest.py variables. 8429 renamed 'conf_capture' conftest setting to 'option_capture' accordingly. 8430 8431* fix issue #27: better reporting on non-collectable items given on commandline 8432 (e.g. pyc files) 8433 8434* fix issue #33: added --version flag (thanks Benjamin Peterson) 8435 8436* fix issue #32: adding support for "incomplete" paths to wcpath.status() 8437 8438* "Test" prefixed classes are *not* collected by default anymore if they 8439 have an __init__ method 8440 8441* monkeypatch setenv() now accepts a "prepend" parameter 8442 8443* improved reporting of collection error tracebacks 8444 8445* simplified multicall mechanism and plugin architecture, 8446 renamed some internal methods and argnames 8447 84481.0.0 (2009-08-04) 8449================== 8450 8451* more terse reporting try to show filesystem path relatively to current dir 8452* improve xfail output a bit 8453 84541.0.0b9 (2009-07-31) 8455==================== 8456 8457* cleanly handle and report final teardown of test setup 8458 8459* fix svn-1.6 compat issue with py.path.svnwc().versioned() 8460 (thanks Wouter Vanden Hove) 8461 8462* setup/teardown or collection problems now show as ERRORs 8463 or with big "E"'s in the progress lines. they are reported 8464 and counted separately. 8465 8466* dist-testing: properly handle test items that get locally 8467 collected but cannot be collected on the remote side - often 8468 due to platform/dependency reasons 8469 8470* simplified py.test.mark API - see keyword plugin documentation 8471 8472* integrate better with logging: capturing now by default captures 8473 test functions and their immediate setup/teardown in a single stream 8474 8475* capsys and capfd funcargs now have a readouterr() and a close() method 8476 (underlyingly py.io.StdCapture/FD objects are used which grew a 8477 readouterr() method as well to return snapshots of captured out/err) 8478 8479* make assert-reinterpretation work better with comparisons not 8480 returning bools (reported with numpy from thanks maciej fijalkowski) 8481 8482* reworked per-test output capturing into the pytest_iocapture.py plugin 8483 and thus removed capturing code from config object 8484 8485* item.repr_failure(excinfo) instead of item.repr_failure(excinfo, outerr) 8486 8487 84881.0.0b8 (2009-07-22) 8489==================== 8490 8491* pytest_unittest-plugin is now enabled by default 8492 8493* introduced pytest_keyboardinterrupt hook and 8494 refined pytest_sessionfinish hooked, added tests. 8495 8496* workaround a buggy logging module interaction ("closing already closed 8497 files"). Thanks to Sridhar Ratnakumar for triggering. 8498 8499* if plugins use "py.test.importorskip" for importing 8500 a dependency only a warning will be issued instead 8501 of exiting the testing process. 8502 8503* many improvements to docs: 8504 - refined funcargs doc , use the term "factory" instead of "provider" 8505 - added a new talk/tutorial doc page 8506 - better download page 8507 - better plugin docstrings 8508 - added new plugins page and automatic doc generation script 8509 8510* fixed teardown problem related to partially failing funcarg setups 8511 (thanks MrTopf for reporting), "pytest_runtest_teardown" is now 8512 always invoked even if the "pytest_runtest_setup" failed. 8513 8514* tweaked doctest output for docstrings in py modules, 8515 thanks Radomir. 8516 85171.0.0b7 8518======= 8519 8520* renamed py.test.xfail back to py.test.mark.xfail to avoid 8521 two ways to decorate for xfail 8522 8523* re-added py.test.mark decorator for setting keywords on functions 8524 (it was actually documented so removing it was not nice) 8525 8526* remove scope-argument from request.addfinalizer() because 8527 request.cached_setup has the scope arg. TOOWTDI. 8528 8529* perform setup finalization before reporting failures 8530 8531* apply modified patches from Andreas Kloeckner to allow 8532 test functions to have no func_code (#22) and to make 8533 "-k" and function keywords work (#20) 8534 8535* apply patch from Daniel Peolzleithner (issue #23) 8536 8537* resolve issue #18, multiprocessing.Manager() and 8538 redirection clash 8539 8540* make __name__ == "__channelexec__" for remote_exec code 8541 85421.0.0b3 (2009-06-19) 8543==================== 8544 8545* plugin classes are removed: one now defines 8546 hooks directly in conftest.py or global pytest_*.py 8547 files. 8548 8549* added new pytest_namespace(config) hook that allows 8550 to inject helpers directly to the py.test.* namespace. 8551 8552* documented and refined many hooks 8553 8554* added new style of generative tests via 8555 pytest_generate_tests hook that integrates 8556 well with function arguments. 8557 8558 85591.0.0b1 8560======= 8561 8562* introduced new "funcarg" setup method, 8563 see doc/test/funcarg.txt 8564 8565* introduced plugin architecture and many 8566 new py.test plugins, see 8567 doc/test/plugins.txt 8568 8569* teardown_method is now guaranteed to get 8570 called after a test method has run. 8571 8572* new method: py.test.importorskip(mod,minversion) 8573 will either import or call py.test.skip() 8574 8575* completely revised internal py.test architecture 8576 8577* new py.process.ForkedFunc object allowing to 8578 fork execution of a function to a sub process 8579 and getting a result back. 8580 8581XXX lots of things missing here XXX 8582 85830.9.2 8584===== 8585 8586* refined installation and metadata, created new setup.py, 8587 now based on setuptools/ez_setup (thanks to Ralf Schmitt 8588 for his support). 8589 8590* improved the way of making py.* scripts available in 8591 windows environments, they are now added to the 8592 Scripts directory as ".cmd" files. 8593 8594* py.path.svnwc.status() now is more complete and 8595 uses xml output from the 'svn' command if available 8596 (Guido Wesdorp) 8597 8598* fix for py.path.svn* to work with svn 1.5 8599 (Chris Lamb) 8600 8601* fix path.relto(otherpath) method on windows to 8602 use normcase for checking if a path is relative. 8603 8604* py.test's traceback is better parseable from editors 8605 (follows the filenames:LINENO: MSG convention) 8606 (thanks to Osmo Salomaa) 8607 8608* fix to javascript-generation, "py.test --runbrowser" 8609 should work more reliably now 8610 8611* removed previously accidentally added 8612 py.test.broken and py.test.notimplemented helpers. 8613 8614* there now is a py.__version__ attribute 8615 86160.9.1 8617===== 8618 8619This is a fairly complete list of v0.9.1, which can 8620serve as a reference for developers. 8621 8622* allowing + signs in py.path.svn urls [39106] 8623* fixed support for Failed exceptions without excinfo in py.test [39340] 8624* added support for killing processes for Windows (as well as platforms that 8625 support os.kill) in py.misc.killproc [39655] 8626* added setup/teardown for generative tests to py.test [40702] 8627* added detection of FAILED TO LOAD MODULE to py.test [40703, 40738, 40739] 8628* fixed problem with calling .remove() on wcpaths of non-versioned files in 8629 py.path [44248] 8630* fixed some import and inheritance issues in py.test [41480, 44648, 44655] 8631* fail to run greenlet tests when pypy is available, but without stackless 8632 [45294] 8633* small fixes in rsession tests [45295] 8634* fixed issue with 2.5 type representations in py.test [45483, 45484] 8635* made that internal reporting issues displaying is done atomically in py.test 8636 [45518] 8637* made that non-existing files are ignored by the py.lookup script [45519] 8638* improved exception name creation in py.test [45535] 8639* made that less threads are used in execnet [merge in 45539] 8640* removed lock required for atomic reporting issue displaying in py.test 8641 [45545] 8642* removed globals from execnet [45541, 45547] 8643* refactored cleanup mechanics, made that setDaemon is set to 1 to make atexit 8644 get called in 2.5 (py.execnet) [45548] 8645* fixed bug in joining threads in py.execnet's servemain [45549] 8646* refactored py.test.rsession tests to not rely on exact output format anymore 8647 [45646] 8648* using repr() on test outcome [45647] 8649* added 'Reason' classes for py.test.skip() [45648, 45649] 8650* killed some unnecessary sanity check in py.test.collect [45655] 8651* avoid using os.tmpfile() in py.io.fdcapture because on Windows it's only 8652 usable by Administrators [45901] 8653* added support for locking and non-recursive commits to py.path.svnwc [45994] 8654* locking files in py.execnet to prevent CPython from segfaulting [46010] 8655* added export() method to py.path.svnurl 8656* fixed -d -x in py.test [47277] 8657* fixed argument concatenation problem in py.path.svnwc [49423] 8658* restore py.test behaviour that it exits with code 1 when there are failures 8659 [49974] 8660* don't fail on html files that don't have an accompanying .txt file [50606] 8661* fixed 'utestconvert.py < input' [50645] 8662* small fix for code indentation in py.code.source [50755] 8663* fix _docgen.py documentation building [51285] 8664* improved checks for source representation of code blocks in py.test [51292] 8665* added support for passing authentication to py.path.svn* objects [52000, 8666 52001] 8667* removed sorted() call for py.apigen tests in favour of [].sort() to support 8668 Python 2.3 [52481] 8669