Up to [cvs.NetBSD.org] / pkgsrc / devel / py-test
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
py-test: remove unused test dependency
py-test: updated to 8.3.3 pytest 8.3.3 (2024-09-09) Bug fixes - Avoid calling ``@property`` (and other instance descriptors) during fixture discovery - Fixed the issue of not displaying assertion failure differences when using the parameter ``--import-mode=importlib`` in pytest>=8.1. - Fixed a regression where type change in `ExceptionInfo.errisinstance` caused `mypy` to fail. - Fixed typing compatibility with Python 3.9 or less -- replaced `typing.Self` with `typing_extensions.Self` - Fixed an issue with backslashes being incorrectly converted in nodeid paths on Windows, ensuring consistent path handling across environments. - Fixed bug where the verbosity levels where not being respected when printing the "msg" part of failed assertion (as in ``assert condition, msg``). - Fix bug where disabling the terminal plugin via ``-p no:terminal`` would cause crashes related to missing the ``verbose`` option. Improved documentation - Clarify that the `pytest_deselected` hook should be called from `pytest_collection_modifyitems` hook implementations when items are deselected. - Remove erroneous quotes from `tmp_path_retention_policy` example in docs. Miscellaneous internal changes - Fix typos discovered by codespell and add codespell to pre-commit hooks.
py-test: updated to 8.3.2 pytest 8.3.2 (2024-07-24) Bug fixes Resolve regression conda environments where no longer being automatically detected.
py-test: updated to 8.3.1 pytest 8.3.1 (2024-07-20) The 8.3.0 release failed to include the change notes and docs for the release. This patch release remedies this. There are no other changes. https://docs.pytest.org/en/stable/changelog.html
py-test: updated to 8.2.2 pytest 8.2.2 (2024-06-04) Bug Fixes - Fix possible catastrophic performance slowdown on a certain parametrization pattern involving many higher-scoped parameters. - Fix a regression in pytest 8.2.0 where unittest class instances (a fresh one is created for each test) were not released promptly on test teardown but only on session teardown. - Fix possible "Directory not empty" crashes arising from concurent cache dir (``.pytest_cache``) creation. Regressed in pytest 8.2.0. Improved Documentation - Updated Sphinx theme to use Furo instead of Flask, enabling Dark mode theme. - Added a subsection to the documentation for debugging flaky tests to mention lack of thread safety in pytest as a possible source of flakyness. - The documentation webpages now links to a canonical version to reduce outdated documentation in search engine results.
py-test: updated to 8.2.1 pytest 8.2.1 (2024-05-19) ========================= Improvements ------------ - Support for Python 3.13 (beta1 at the time of writing). Bug Fixes --------- - Fix `PermissionError` crashes arising from directories which are not selected on the command-line. - Keyboard interrupts and system exits are now properly handled during the test collection. - Fixed handling of 'Function not implemented' error under squashfuse_ll, which is a different way to say that the mountpoint is read-only. - Fix a regression in pytest 8.2.0 where the permissions of automatically-created ``.pytest_cache`` directories became ``rwx------`` instead of the expected ``rwxr-xr-x``. Trivial/Internal Changes ------------------------ - pytest releases are now attested using the recent `Artifact Attestation <https://github.blog/2024-05-02-introducing-artifact-attestations-now-in-public-beta/>` support from GitHub, allowing users to verify the provenance of pytest's sdist and wheel artifacts.
py-test: updated to 8.2.0 pytest 8.2.0 (2024-04-27) Deprecations A deprecation warning is now raised when implementations of one of the following hooks request a deprecated py.path.local parameter instead of the pathlib.Path parameter which replaced it: pytest_ignore_collect - the path parameter - use collection_path instead. pytest_collect_file - the path parameter - use file_path instead. pytest_pycollect_makemodule - the path parameter - use module_path instead. pytest_report_header - the startdir parameter - use start_path instead. pytest_report_collectionfinish - the startdir parameter - use start_path instead. The replacement parameters are available since pytest 7.0.0. The old parameters will be removed in pytest 9.0.0. See py.path.local arguments for hooks replaced with pathlib.Path for more details. Features Added support for reading command line arguments from a file using the prefix character @, like e.g.: pytest @tests.txt. The file must have one argument per line. See Read arguments from file for details. Improvements pytest.importorskip() will now issue a warning if the module could be found, but raised ImportError instead of ModuleNotFoundError. The warning can be suppressed by passing exc_type=ImportError to pytest.importorskip(). See pytest.importorskip default behavior regarding ImportError for details. For unittest-based tests, exceptions during class cleanup (as raised by functions registered with TestCase.addClassCleanup) are now reported instead of silently failing. Text is no longer truncated in the short test summary info section when -vv is given. Improved namespace packages detection when consider_namespace_packages is enabled, covering more situations (like editable installs). Added PYTEST_VERSION environment variable which is defined at the start of the pytest session and undefined afterwards. It contains the value of pytest.__version__, and among other things can be used to easily check if code is running from within a pytest run. Bug Fixes Fixed a regression in pytest 8.0.0 where test classes containing setup_method and tests using @staticmethod or @classmethod would crash with AttributeError: 'NoneType' object has no attribute 'setup_method'. Now the request.instance attribute of tests using @staticmethod and @classmethod is no longer None, but a fresh instance of the class, like in non-static methods. Previously it was None, and all fixtures of such tests would share a single self. Fixed issue where fixtures adding their finalizer multiple times to fixtures they request would cause unreliable and non-intuitive teardown ordering in some instances. Fixed a bug with --importmode=importlib and --doctest-modules where child modules did not appear as attributes in parent modules. Fixed some instances where teardown of higher-scoped fixtures was not happening in the reverse order they were initialized in. Trivial/Internal Changes pluggy>=1.5.0 is now required. cache: create supporting files (CACHEDIR.TAG, .gitignore, etc.) in a temporary directory to provide atomic semantics.
py-test: updated to 8.1.2 pytest 8.1.2 (2024-04-26) Bug Fixes Fixed error in pytest.approx() when used with numpy arrays and comparing with other types.
py-test: updated to 8.1.1 pytest 8.1.1 (2024-03-08) ========================= This release is not a usual bug fix release -- it contains features and improvements, being a follow up to ``8.1.0``, which has been yanked from PyPI. Features -------- - Added the new :confval:`consider_namespace_packages` configuration option, defaulting to ``False``. If set to ``True``, pytest will attempt to identify modules that are part of `namespace packages <https://packaging.python.org/en/latest/guides/packaging-namespace-packages>`__ when importing modules. - Added the new :confval:`verbosity_test_cases` configuration option for fine-grained control of test execution verbosity. See :ref:`Fine-grained verbosity <pytest.fine_grained_verbosity>` for more details. Improvements ------------ - :func:`pytest.warns` now validates that :func:`warnings.warn` was called with a `str` or a `Warning`. Currently in Python it is possible to use other types, however this causes an exception when :func:`warnings.filterwarnings` is used to filter those warnings. While this can be considered a bug in CPython, we decided to put guards in pytest as the error message produced without this check in place is confusing. - When using ``--override-ini`` for paths in invocations without a configuration file defined, the current working directory is used as the relative directory. Previoulsy this would raise an :class:`AssertionError`. - :ref:`--import-mode=importlib <import-mode-importlib>` now tries to import modules using the standard import mechanism (but still without changing :py:data:`sys.path`), falling back to importing modules directly only if that fails. This means that installed packages will be imported under their canonical name if possible first, for example ``app.core.models``, instead of having the module name always be derived from their path (for example ``.env310.lib.site_packages.app.core.models``). - Added the :func:`iter_parents() <_pytest.nodes.Node.iter_parents>` helper method on nodes. It is similar to :func:`listchain <_pytest.nodes.Node.listchain>`, but goes from bottom to top, and returns an iterator, not a list. - Added support for :data:`sys.last_exc` for post-mortem debugging on Python>=3.12. - In case no other suitable candidates for configuration file are found, a ``pyproject.toml`` (even without a ``[tool.pytest.ini_options]`` table) will be considered as the configuration file and define the ``rootdir``. - Add ``--log-file-mode`` option to the logging plugin, enabling appending to log-files. This option accepts either ``"w"`` or ``"a"`` and defaults to ``"w"``. Previously, the mode was hard-coded to be ``"w"`` which truncates the file before logging. - When multiple finalizers of a fixture raise an exception, now all exceptions are reported as an exception group. Previously, only the first exception was reported. Bug Fixes --------- - Fixed regression where ``--importmode=importlib`` would import non-test modules more than once. - Fixed a regression in pytest 8.0.0 that would cause test collection to fail due to permission errors when using ``--pyargs``. This change improves the collection tree for tests specified using ``--pyargs``, see :pull:`12043` for a comparison with pytest 8.0 and <8. - Fixed a regression in 8.0.1 whereby ``setup_module`` xunit-style fixtures are not executed when ``--doctest-modules`` is passed. - Fix the ``stacklevel`` used when warning about marks used on fixtures. - Fixed a regression in ``8.0.2`` where tests created using :fixture:`tmp_path` have been collected multiple times in CI under Windows. Improved Documentation ---------------------- - Documented the retention of temporary directories created using the ``tmp_path`` fixture in more detail. Trivial/Internal Changes ------------------------ - Some changes were made to private functions which may affect plugins which access them: - ``FixtureManager._getautousenames()`` now takes a ``Node`` itself instead of the nodeid. - ``FixtureManager.getfixturedefs()`` now takes the ``Node`` itself instead of the nodeid. - The ``_pytest.nodes.iterparentnodeids()`` function is removed without replacement. Prefer to traverse the node hierarchy itself instead. If you really need to, copy the function from the previous pytest release. - Delayed the deprecation of the following features to ``9.0.0``: * :ref:`node-ctor-fspath-deprecation`. * :ref:`legacy-path-hooks-deprecated`. It was discovered after ``8.1.0`` was released that the warnings about the impeding removal were not being displayed, so the team decided to revert the removal. This is the reason for ``8.1.0`` being yanked.
py-test: updated to 8.0.2 pytest 8.0.2 (2024-02-24) Bug Fixes - Fix collection on Windows where initial paths contain the short version of a path (for example ``c:\PROGRA~1\tests``). - Fix an ``IndexError`` crash raising from ``getstatementrange_ast``. - Reverted a fix to `--maxfail` handling in pytest 8.0.0 because it caused a regression in pytest-xdist whereby session fixture teardowns may get executed multiple times when the max-fails is reached.
py-test: updated to 8.0.1 pytest 8.0.1 (2024-02-16) Bug Fixes - Correctly handle errors from :func:`getpass.getuser` in Python 3.13. - Fix an edge case where ``ExceptionInfo._stringify_exception`` could crash :func:`pytest.raises`. - Fix regression with :func:`pytest.warns` using custom warning subclasses which have more than one parameter in their `__init__`. - Fix a regression in pytest 8.0.0 whereby calling :func:`pytest.skip` and similar control-flow exceptions within a :func:`pytest.warns()` block would get suppressed instead of propagating. - Fix a regression in pytest 8.0.0 whereby autouse fixtures defined in a module get ignored by the doctests in the module. - Fix a regression in pytest 8.0.0 whereby items would be collected in reverse order in some circumstances.
py-test: updated to 8.0.0 pytest 8.0.0 (2024-01-27) Bug Fixes * Properly escape the reason of a skip mark when writing JUnit XML files. * Avoid microsecond exceeds 1_000_000 when using log-date-format with %f specifier, which might cause the test suite to crash. https://docs.pytest.org/en/stable/changelog.html
py-test: updated to 7.4.4 pytest 7.4.4 (2023-12-31) Bug Fixes - Fix non-string constants at the top of file being detected as docstrings on Python>=3.8. - Handle an edge case where :data:`sys.stderr` and :data:`sys.__stderr__` might already be closed when :ref:`faulthandler` is tearing down. - Fixed tracebacks from collection errors not getting pruned. - Removed unhelpful error message from assertion rewrite mechanism when exceptions are raised in ``__iter__`` methods. Now they are treated un-iterable instead. Improved Documentation - Updated documentation to refer to hyphenated options: replaced ``--junitxml`` with ``--junit-xml`` and ``--collectonly`` with ``--collect-only``.
py-test: updated to 7.4.3 pytest 7.4.3 (2023-10-24) Bug Fixes - Markers are now considered in the reverse mro order to ensure base class markers are considered first -- this resolves a regression. - Fixed ``:=`` in asserts impacting unrelated test cases. - Handled an edge case where :data:`sys.stderr` might already be closed when :ref:`faulthandler` is tearing down.
*: update for Python base package change Instead of depending on one of the removed packages (that are now included in the base Python packages), include batteries-included.mk to require a Python version that supplies them. Remove now included packages. Bump PKGREVISION.
py-test: updated to 7.4.2 pytest 7.4.2 (2023-09-07) ========================= Bug Fixes --------- - Fix doctest collection of `functools.cached_property` objects. - Fixed bug using ``--importmode=importlib`` which would cause package ``__init__.py`` files to be imported more than once in some cases. - Fixed bug where `user_properties` where not being saved in the JUnit XML file if a fixture failed during teardown. - Fixed crash when parsing long command line arguments that might be interpreted as files. Improved Documentation ---------------------- - Improved disclaimer on pytest plugin reference page to better indicate this is an automated, non-curated listing.
py-test: updated to 7.4.1 pytest 7.4.1 (2023-09-02) ========================= Bug Fixes --------- - Fixed bug where fake intermediate modules generated by ``--import-mode=importlib`` would not include the child modules as attributes of the parent modules. - Fixed error assertion handling in :func:`pytest.approx` when ``None`` is an expected or received value when comparing dictionaries. - Fixed issue when using ``--import-mode=importlib`` together with ``--doctest-modules`` that caused modules to be imported more than once, causing problems with modules that have import side effects.
py-test: updated to 7.4.0 pytest 7.4.0 (2023-06-23) Features * Added ExceptionInfo.from_exception(), a simpler way to create an ExceptionInfo from an exception. This can replace ExceptionInfo.from_exc_info() for most uses. Improvements * Update test log report annotation to named tuple and fixed inconsistency in docs for pytest_report_teststatus hook. * When an exception traceback to be displayed is completely filtered out (by mechanisms such as __tracebackhide__, internal frames, and similar), now only the exception string and the following message are shown: “All traceback entries are hidden. Pass --full-trace to see hidden and internal frames.”. Previously, the last frame of the traceback was shown, even though it was hidden. * Improved verbose output (-vv) of skip and xfail reasons by performing text wrapping while leaving a clear margin for progress output. Added TerminalReporter.wrap_write() as a helper for that. * Added handling of %f directive to print microseconds in log format options, such as log-date-format. * Added the underlying exception to the cache provider’s path creation and write warning messages. * Added warning when testpaths is set, but paths are not found by glob. In this case, pytest will fall back to searching from the current directory. * When --confcutdir is not specified, and there is no config file present, the conftest cutoff directory (--confcutdir) is now set to the rootdir. Previously in such cases, conftest.py files would be probed all the way to the root directory of the filesystem. If you are badly affected by this change, consider adding an empty config file to your desired cutoff directory, or explicitly set --confcutdir. * The norecursedirs check is now performed in a pytest_ignore_collect implementation, so plugins can affect it. If after updating to this version you see that your norecursedirs setting is not being respected, it means that a conftest or a plugin you use has a bad pytest_ignore_collect implementation. Most likely, your hook returns False for paths it does not want to ignore, which ends the processing and doesn’t allow other plugins, including pytest itself, to ignore the path. The fix is to return None instead of False for paths your hook doesn’t want to ignore. * caplog.set_level() and caplog.at_level() will temporarily enable the requested level if level was disabled globally via logging.disable(LEVEL). Bug Fixes * Terminal Reporting: Fixed bug when running in --tb=line mode where pytest.fail(pytrace=False) tests report None. * Fixed the --last-failed whole-file skipping functionality (“skipped N files”) for non-python test files. * Fixed a regression in pytest 7.3.2 which caused to testpaths to be considered for loading initial conftests, even when it was not utilized (e.g. when explicit paths were given on the command line). Now the testpaths are only considered when they are in use. * Fixed traceback entries hidden with __tracebackhide__ = True still being shown for chained exceptions (parts after “… the above exception …” message). * Fix writing non-encodable text to log file when using --debug. Improved Documentation * Improved documentation for caplog.set_level(). Trivial/Internal Changes * Enhanced the CLI flag for -c to now include --config-file to make it clear that this flag applies to the usage of a custom config file.
py-test: updated to 7.3.2 pytest 7.3.2 (2023-06-10) ========================= Bug Fixes --------- - Fix bug where very long option names could cause pytest to break with ``OSError: [Errno 36] File name too long`` on some systems. - Support for Python 3.12 (beta at the time of writing). - :confval:`testpaths` is now honored to load root ``conftests``. - The `monkeypatch` `setitem`/`delitem` type annotations now allow `TypedDict` arguments. - Fixed bug in assertion rewriting where a variable assigned with the walrus operator could not be used later in a function call. - Fixed ``--last-failed``'s "(skipped N files)" functionality for files inside of packages (directories with `__init__.py` files).
py-test: updated to 7.3.1 pytest 7.3.1 (2023-04-14) ========================= Improvements ------------ - Python 3.12 support: fixed ``RuntimeError: TestResult has no addDuration method`` when running ``unittest`` tests. - Python 3.12 support: fixed ``shutil.rmtree(onerror=...)`` deprecation warning when using :fixture:`tmp_path`. Bug Fixes --------- - Fixed performance regression related to :fixture:`tmp_path` and the new :confval:`tmp_path_retention_policy` option. - Fix crash ``INTERNALERROR IndexError: list index out of range`` which happens when displaying an exception where all entries are hidden. This reverts the change "Correctly handle ``__tracebackhide__`` for chained exceptions." introduced in version 7.3.0. pytest 7.3.0 (2023-04-08) ========================= Features -------- - Test methods decorated with ``@classmethod`` can now be discovered as tests, following the same rules as normal methods. This fills the gap that static methods were discoverable as tests but not class methods. - :confval:`console_output_style` now supports ``progress-even-when-capture-no`` to force the use of the progress output even when capture is disabled. This is useful in large test suites where capture may have significant performance impact. - ``--log-disable`` CLI option added to disable individual loggers. - Added :confval:`tmp_path_retention_count` and :confval:`tmp_path_retention_policy` configuration options to control how directories created by the :fixture:`tmp_path` fixture are kept. Improvements ------------ - If multiple errors are raised in teardown, we now re-raise an ``ExceptionGroup`` of them instead of discarding all but the last. - Allow ``-p`` arguments to include spaces (eg: ``-p no:logging`` instead of ``-pno:logging``). Mostly useful in the ``addopts`` section of the configuration file. - Added ``start`` and ``stop`` timestamps to ``TestReport`` objects. - Split the report header for ``rootdir``, ``config file`` and ``testpaths`` so each has its own line. - pytest should no longer crash on AST with pathological position attributes, for example testing AST produced by `Hylang <https://github.com/hylang/hy>__`. - The full output of a test is no longer truncated if the truncation message would be longer than the hidden text. The line number shown has also been fixed. Bug Fixes --------- - The assertion rewriting mechanism now works correctly when assertion expressions contain the walrus operator. - Fixed :fixture:`tmp_path` fixture always raising :class:`OSError` on ``emscripten`` platform due to missing :func:`os.getuid`. - Correctly handle ``__tracebackhide__`` for chained exceptions. NOTE: This change was reverted in version 7.3.1. Improved Documentation ---------------------- - Fixed the minimal example in :ref:`goodpractices`: ``pip install -e .`` requires a ``version`` entry in ``pyproject.toml`` to run successfully. Trivial/Internal Changes ------------------------ - pytest no longer directly depends on the `attrs <https://www.attrs.org/en/stable/>`__ package. While we at pytest all love the package dearly and would like to thank the ``attrs`` team for many years of cooperation and support, it makes sense for ``pytest`` to have as little external dependencies as possible, as this helps downstream projects. With that in mind, we have replaced the pytest's limited internal usage to use the standard library's ``dataclasses`` instead. Nice diffs for ``attrs`` classes are still supported though.
*: use PYTHON_VERSION instead of _PYTHON_VERSION
py-test: updated to 7.2.2 pytest 7.2.2 (2023-03-03) Bug Fixes --------- - Fixed :func:`pytest.approx` handling of dictionaries containing one or more values of `0.0`. - Fixed crash if `--cache-show` and `--help` are passed at the same time. - Fixed bug where a fixture method named ``teardown`` would be called as part of ``nose`` teardown stage. - Fixed crash if ``--fixtures`` and ``--help`` are passed at the same time. - Fixed :py:func:`pytest.raises` to return a 'ContextManager' so that type-checkers could narrow :code:`pytest.raises(...) if ... else nullcontext()` down to 'ContextManager' rather than 'object'. Improved Documentation ---------------------- - Added `CI` and `BUILD_NUMBER` environment variables to the documentation. - Fixed entry-points declaration in the documentation example using Hatch. - Changed wording of the module level skip to be very explicit about not collecting tests and not executing the rest of the module.
py-test: updated to 7.2.1 pytest 7.2.1 (2023-01-13) Bug Fixes Fix ‘importlib.abc.TraversableResources’ deprecation warning in Python 3.12. If a test is skipped from inside a fixture, the test summary now shows the test location instead of the fixture location. Fix bug where sometimes pytest would use the file system root directory as rootdir on Windows. Fix a race condition when creating junitxml reports, which could occur when multiple instances of pytest execute in parallel. Fix a race condition when creating or updating the stepwise plugin’s cache, which could occur when multiple xdist worker nodes try to simultaneously update the stepwise plugin’s cache.
py-test: updated to 7.2.0 pytest 7.2.0 (2022-10-23) Deprecations * Update pytest.PytestUnhandledCoroutineWarning to a deprecation; it will raise an error in pytest 8. * pytest no longer depends on the py library. pytest provides a vendored copy of py.error and py.path modules but will use the py library if it is installed. If you need other py.* modules, continue to install the deprecated py library separately, otherwise it can usually be removed as a dependency. * Deprecate configuring hook specs/impls using attributes/marks. Instead use pytest.hookimpl() and pytest.hookspec(). For more details, see the docs. * The functionality for running tests written for nose has been officially deprecated. This includes: Plain setup and teardown functions and methods: this might catch users by surprise, as setup() and teardown() are not pytest idioms, but part of the nose support. Setup/teardown using the @with_setup decorator. For more details, consult the deprecation docs. * A deprecation warning is now emitted if a test function returns something other than None. This prevents a common mistake among beginners that expect that returning a bool (for example return foo(a, b) == result) would cause a test to pass or fail, instead of using assert. The plan is to make returning non-None from tests an error in the future. Features * Added shell-style wildcard support to testpaths. Improvements * @pytest.mark.parametrize() (and similar functions) now accepts any Sequence[str] for the argument names, instead of just list[str] and tuple[str, ...]. (Note that str, which is itself a Sequence[str], is still treated as a comma-delimited name list, as before). * The --no-showlocals flag has been added. This can be passed directly to tests to override --showlocals declared through addopts. * Assertion failures with strings in NFC and NFD forms that normalize to the same string now have a dedicated error message detailing the issue, and their utf-8 representation is expressed instead. * Introduce multiline display for warning matching via pytest.warns() and enhance match comparison for _pytest._code.ExceptionInfo.match() as returned by pytest.raises(). * Improve pytest.raises(). Previously passing an empty tuple would give a confusing error. We now raise immediately with a more helpful message. * On Python 3.11, use the standard library’s tomllib to parse TOML. tomli is no longer a dependency on Python 3.11. * Display assertion message without escaped newline characters with -vv. * Improved error message that is shown when no collector is found for a given file. * Some coloring has been added to the short test summary. * Normalize the help description of all command-line options. * Display full crash messages in short test summary info, when running in a CI environment. * Added support for hidden configuration file by allowing .pytest.ini as an alternative to pytest.ini. Bug Fixes * sys.stdin now contains all expected methods of a file-like object when capture is enabled. * Do not break into pdb when raise unittest.SkipTest() appears top-level in a file. * Marks are now inherited according to the full MRO in test classes. Previously, if a test class inherited from two or more classes, only marks from the first super-class would apply. When inheriting marks from super-classes, marks from the sub-classes are now ordered before marks from the super-classes, in MRO order. Previously it was the reverse. When inheriting marks from super-classes, the pytestmark attribute of the sub-class now only contains the marks directly applied to it. Previously, it also contained marks from its super-classes. Please note that this attribute should not normally be accessed directly; use pytest.Node.iter_markers() instead. * Showing inner exceptions by forcing native display in ExceptionGroups even when using display options other than --tb=native. A temporary step before full implementation of pytest-native display for inner exceptions in ExceptionGroups. * Ensure caplog.get_records(when) returns current/correct data after invoking caplog.clear(). Improved Documentation * Update information on writing plugins to use pyproject.toml instead of setup.py. * The documentation is now built using Sphinx 5.x (up from 3.x previously). * Update documentation on how pytest.warns() affects DeprecationWarning. Trivial/Internal Changes * Made _pytest.doctest.DoctestItem export pytest.DoctestItem for type check and runtime purposes. Made _pytest.doctest use internal APIs to avoid circular imports. * Made _pytest.compat re-export importlib_metadata in the eyes of type checkers. * Fix default encoding warning (EncodingWarning) in cacheprovider * Improve the error message when we attempt to access a fixture that has been torn down. Add an additional sentence to the docstring explaining when it’s not a good idea to call getfixturevalue.
py-test: updated to 7.1.3 pytest 7.1.3 (2022-08-31) Bug Fixes --------- - When running with ``--pdb``, ``TestCase.tearDown`` is no longer called for tests when the *class* has been skipped via ``unittest.skip`` or ``pytest.mark.skip``. - Invalid XML characters in setup or teardown error messages are now properly escaped for JUnit XML reports. - Ignore ``.py`` files created by ``pyproject.toml``-based editable builds introduced in `pip 21.3 <https://pip.pypa.io/en/stable/news/#v21-3>`__. - Doctests now respect the ``--import-mode`` flag. - Type-annotate ``FixtureRequest.param`` as ``Any`` as a stop gap measure until :issue:`8073` is fixed. - Fixed a path handling code in ``rewrite.py`` that seems to work fine, but was incorrect and fails in some systems. - Fixed string representation for :func:`pytest.approx` when used to compare tuples. Improved Documentation ---------------------- - Explicit note that :fixture:`tmpdir` fixture is discouraged in favour of :fixture:`tmp_path`. Trivial/Internal Changes ------------------------ - Replace `atomicwrites <https://github.com/untitaker/python-atomicwrites>`__ dependency on windows with `os.replace`.
py-test: updated to 7.1.2 pytest 7.1.2 Bug Fixes * An unnecessary numpy import inside pytest.approx() was removed. * Fix comparison of dataclasses with InitVar. * Increase stacklevel for the NODE_CTOR_FSPATH_ARG deprecation to point to the user’s code, not pytest. * Fix a bizarre (and fortunately rare) bug where the temp_path fixture could raise an internal error while attempting to get the current user’s username.
py-test: updated to 7.1.1 pytest 7.1.1 (2022-03-17) ========================= Bug Fixes --------- - Fixed a regression in pytest 7.1.0 where some conftest.py files outside of the source tree (e.g. in the `site-packages` directory) were not picked up. pytest 7.1.0 (2022-03-13) ========================= Breaking Changes ---------------- - As per our policy, the following features have been deprecated in the 6.X series and are now removed: * ``pytest._fillfuncargs`` function. * ``pytest_warning_captured`` hook - use ``pytest_warning_recorded`` instead. * ``-k -foobar`` syntax - use ``-k 'not foobar'`` instead. * ``-k foobar:`` syntax. * ``pytest.collect`` module - import from ``pytest`` directly. For more information consult `Deprecations and Removals <https://docs.pytest.org/en/latest/deprecations.html>`__ in the docs. - Dropped support for Python 3.6, which reached `end-of-life <https://devguide.python.org/#status-of-python-branches>`__ at 2021-12-23. Improvements ------------ - Fixed test output for some data types where ``-v`` would show less information. Also, when showing diffs for sequences, ``-q`` would produce full diffs instead of the expected diff. - pytest now avoids specialized assert formatting when it is detected that the default ``__eq__`` is overridden in ``attrs`` or ``dataclasses``. - When ``-vv`` is given on command line, show skipping and xfail reasons in full instead of truncating them to fit the terminal width. - More information about the location of resources that led Python to raise :class:`ResourceWarning` can now be obtained by enabling :mod:`tracemalloc`. See :ref:`resource-warnings` for more information. - More types are now accepted in the ``ids`` argument to ``@pytest.mark.parametrize``. Previously only `str`, `float`, `int` and `bool` were accepted; now `bytes`, `complex`, `re.Pattern`, `Enum` and anything with a `__name__` are also accepted. - :func:`pytest.approx` now raises a :class:`TypeError` when given an unordered sequence (such as :class:`set`). Note that this implies that custom classes which only implement ``__iter__`` and ``__len__`` are no longer supported as they don't guarantee order. Bug Fixes --------- - The deprecation of raising :class:`unittest.SkipTest` to skip collection of tests during the pytest collection phase is reverted - this is now a supported feature again. - Symbolic link components are no longer resolved in conftest paths. This means that if a conftest appears twice in collection tree, using symlinks, it will be executed twice. For example, given tests/real/conftest.py tests/real/test_it.py tests/link -> tests/real running ``pytest tests`` now imports the conftest twice, once as ``tests/real/conftest.py`` and once as ``tests/link/conftest.py``. This is a fix to match a similar change made to test collection itself in pytest 6.0 (see :pull:`6523` for details). - Fixed count of selected tests on terminal collection summary when there were errors or skipped modules. If there were errors or skipped modules on collection, pytest would mistakenly subtract those from the selected count. - Fixed regression where ``--import-mode=importlib`` used together with :envvar:`PYTHONPATH` or :confval:`pythonpath` would cause import errors in test suites. - :fixture:`pytester` now requests a :fixture:`monkeypatch` fixture instead of creating one internally. This solves some issues with tests that involve pytest environment variables. - Malformed ``pyproject.toml`` files now produce a clearer error message.
py-test: update to 7.0.1. pytest 7.0.1 (2022-02-11) Bug Fixes #9608: Fix invalid importing of importlib.readers in Python 3.9. #9610: Restore UnitTestFunction.obj to return unbound rather than bound method. Fixes a crash during a failed teardown in unittest TestCases with non-default __init__. Regressed in pytest 7.0.0. #9636: The pythonpath plugin was renamed to python_path. This avoids a conflict with the pytest-pythonpath plugin. #9642: Fix running tests by id with :: in the parametrize portion. #9643: Delay issuing a PytestWarning about diamond inheritance involving Item and Collector so it can be filtered using standard warning filters. pytest 7.0.0 (2022-02-03) (Please see the full set of changes for this release also in the 7.0.0rc1 notes below) Deprecations #9488: If custom subclasses of nodes like pytest.Item override the __init__ method, they should take **kwargs. See Constructors of custom pytest.Node subclasses should take **kwargs for details. Note that a deprection warning is only emitted when there is a conflict in the arguments pytest expected to pass. This deprecation was already part of pytest 7.0.0rc1 but wasn’t documented. Bug Fixes #9355: Fixed error message prints function decorators when using assert in Python 3.8 and above. #9396: Ensure pytest.Config.inifile is available during the pytest_cmdline_main hook (regression during 7.0.0rc1). Improved Documentation #9404: Added extra documentation on alternatives to common misuses of pytest.warns(None) ahead of its deprecation. #9505: Clarify where the configuration files are located. To avoid confusions documentation mentions that configuration file is located in the root of the repository. pytest 7.0.0rc1 (2021-12-06) Breaking Changes #7259: The Node.reportinfo() function first return value type has been expanded from py.path.local | str to os.PathLike[str] | str. Most plugins which refer to reportinfo() only define it as part of a custom pytest.Item implementation. Since py.path.local is a os.PathLike[str], these plugins are unaffacted. Plugins and users which call reportinfo(), use the first return value and interact with it as a py.path.local, would need to adjust by calling py.path.local(fspath). Although preferably, avoid the legacy py.path.local and use pathlib.Path, or use item.location or item.path, instead. Note: pytest was not able to provide a deprecation period for this change. #8246: --version now writes version information to stdout rather than stderr. #8733: Drop a workaround for pyreadline that made it work with --pdb. The workaround was introduced in #1281 in 2015, however since then pyreadline seems to have gone unmaintained, is generating warnings, and will stop working on Python 3.10. #9061: Using pytest.approx() in a boolean context now raises an error hinting at the proper usage. It is apparently common for users to mistakenly use pytest.approx like this: assert pytest.approx(actual, expected) While the correct usage is: assert actual == pytest.approx(expected) The new error message helps catch those mistakes. #9277: The pytest.Instance collector type has been removed. Importing pytest.Instance or _pytest.python.Instance returns a dummy type and emits a deprecation warning. See The pytest.Instance collector for details. #9308: PytestRemovedIn7Warning deprecation warnings are now errors by default. Following our plan to remove deprecated features with as little disruption as possible, all warnings of type PytestRemovedIn7Warning now generate errors instead of warning messages by default. The affected features will be effectively removed in pytest 7.1, so please consult the Deprecations and Removals section in the docs for directions on how to update existing code. In the pytest 7.0.X series, it is possible to change the errors back into warnings as a stopgap measure by adding this to your pytest.ini file: [pytest] filterwarnings = ignore::pytest.PytestRemovedIn7Warning But this will stop working when pytest 7.1 is released. If you have concerns about the removal of a specific feature, please add a comment to issue #9308. Deprecations #7259: py.path.local arguments for hooks have been deprecated. See the deprecation note for full details. py.path.local arguments to Node constructors have been deprecated. See the deprecation note for full details. Note The name of the Node arguments and attributes (the new attribute being path) is the opposite of the situation for hooks (the old argument being path). This is an unfortunate artifact due to historical reasons, which should be resolved in future versions as we slowly get rid of the py dependency (see issue #9283 for a longer discussion). #7469: Directly constructing the following classes is now deprecated: _pytest.mark.structures.Mark _pytest.mark.structures.MarkDecorator _pytest.mark.structures.MarkGenerator _pytest.python.Metafunc _pytest.runner.CallInfo _pytest._code.ExceptionInfo _pytest.config.argparsing.Parser _pytest.config.argparsing.OptionGroup _pytest.pytester.HookRecorder These constructors have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 8. #8242: Raising unittest.SkipTest to skip collection of tests during the pytest collection phase is deprecated. Use pytest.skip() instead. Note: This deprecation only relates to using unittest.SkipTest during test collection. You are probably not doing that. Ordinary usage of unittest.SkipTest / unittest.TestCase.skipTest() / unittest.skip() in unittest test cases is fully supported. #8315: Several behaviors of Parser.addoption are now scheduled for removal in pytest 8 (deprecated since pytest 2.4.0): parser.addoption(..., help=".. %default ..") - use %(default)s instead. parser.addoption(..., type="int/string/float/complex") - use type=int etc. instead. #8447: Defining a custom pytest node type which is both an pytest.Item and a pytest.Collector (e.g. pytest.File) now issues a warning. It was never sanely supported and triggers hard to debug errors. See the deprecation note for full details. #8592: pytest_cmdline_preparse has been officially deprecated. It will be removed in a future release. Use pytest_load_initial_conftests instead. See the deprecation note for full details. #8645: pytest.warns(None) is now deprecated because many people used it to mean “this code does not emit warnings”, but it actually had the effect of checking that the code emits at least one warning of any type - like pytest.warns() or pytest.warns(Warning). #8948: pytest.skip(msg=...), pytest.fail(msg=...) and pytest.exit(msg=...) signatures now accept a reason argument instead of msg. Using msg still works, but is deprecated and will be removed in a future release. This was changed for consistency with pytest.mark.skip and pytest.mark.xfail which both accept reason as an argument. #8174: The following changes have been made to types reachable through pytest.ExceptionInfo.traceback: The path property of _pytest.code.Code returns Path instead of py.path.local. The path property of _pytest.code.TracebackEntry returns Path instead of py.path.local. There was no deprecation period for this change (sorry!). Features #5196: Tests are now ordered by definition order in more cases. In a class hierarchy, tests from base classes are now consistently ordered before tests defined on their subclasses (reverse MRO order). #7132: Added two environment variables PYTEST_THEME and PYTEST_THEME_MODE to let the users customize the pygments theme used. #7259: Added cache.mkdir(), which is similar to the existing cache.makedir(), but returns a pathlib.Path instead of a legacy py.path.local. Added a paths type to parser.addini(), as in parser.addini("mypaths", "my paths", type="paths"), which is similar to the existing pathlist, but returns a list of pathlib.Path instead of legacy py.path.local. #7469: The types of objects used in pytest’s API are now exported so they may be used in type annotations. The newly-exported types are: pytest.Config for Config. pytest.Mark for marks. pytest.MarkDecorator for mark decorators. pytest.MarkGenerator for the pytest.mark singleton. pytest.Metafunc for the metafunc argument to the pytest_generate_tests hook. pytest.CallInfo for the CallInfo type passed to various hooks. pytest.PytestPluginManager for PytestPluginManager. pytest.ExceptionInfo for the ExceptionInfo type returned from pytest.raises() and passed to various hooks. pytest.Parser for the Parser type passed to the pytest_addoption hook. pytest.OptionGroup for the OptionGroup type returned from the parser.addgroup method. pytest.HookRecorder for the HookRecorder type returned from Pytester. pytest.RecordedHookCall for the RecordedHookCall type returned from HookRecorder. pytest.RunResult for the RunResult type returned from Pytester. pytest.LineMatcher for the LineMatcher type used in RunResult and others. pytest.TestReport for the TestReport type used in various hooks. pytest.CollectReport for the CollectReport type used in various hooks. Constructing most of them directly is not supported; they are only meant for use in type annotations. Doing so will emit a deprecation warning, and may become a hard-error in pytest 8.0. Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy. #7856: –import-mode=importlib now works with features that depend on modules being on sys.modules, such as pickle and dataclasses. #8144: The following hooks now receive an additional pathlib.Path argument, equivalent to an existing py.path.local argument: pytest_ignore_collect - The collection_path parameter (equivalent to existing path parameter). pytest_collect_file - The file_path parameter (equivalent to existing path parameter). pytest_pycollect_makemodule - The module_path parameter (equivalent to existing path parameter). pytest_report_header - The start_path parameter (equivalent to existing startdir parameter). pytest_report_collectionfinish - The start_path parameter (equivalent to existing startdir parameter). Note The name of the Node arguments and attributes (the new attribute being path) is the opposite of the situation for hooks (the old argument being path). This is an unfortunate artifact due to historical reasons, which should be resolved in future versions as we slowly get rid of the py dependency (see issue #9283 for a longer discussion). #8251: Implement Node.path as a pathlib.Path. Both the old fspath and this new attribute gets set no matter whether path or fspath (deprecated) is passed to the constructor. It is a replacement for the fspath attribute (which represents the same path as py.path.local). While fspath is not deprecated yet due to the ongoing migration of methods like reportinfo(), we expect to deprecate it in a future release. Note The name of the Node arguments and attributes (the new attribute being path) is the opposite of the situation for hooks (the old argument being path). This is an unfortunate artifact due to historical reasons, which should be resolved in future versions as we slowly get rid of the py dependency (see issue #9283 for a longer discussion). #8421: pytest.approx() now works on Decimal within mappings/dicts and sequences/lists. #8606: pytest invocations with --fixtures-per-test and --fixtures have been enriched with: Fixture location path printed with the fixture name. First section of the fixture’s docstring printed under the fixture name. Whole of fixture’s docstring printed under the fixture name using --verbose option. #8761: New pytest.version_tuple attribute, which makes it simpler for users to do something depending on the pytest version (such as declaring hooks which are introduced in later versions). #8789: Switch TOML parser from toml to tomli for TOML v1.0.0 support in pyproject.toml. #8920: Added pytest.Stash, a facility for plugins to store their data on Config and Nodes in a type-safe and conflict-free manner. See Storing data on items across hook functions for details. #8953: RunResult method assert_outcomes now accepts a warnings argument to assert the total number of warnings captured. #8954: --debug flag now accepts a str file to route debug logs into, remains defaulted to pytestdebug.log. #9023: Full diffs are now always shown for equality assertions of iterables when CI or BUILD_NUMBER is found in the environment, even when -v isn’t used. #9113: RunResult method assert_outcomes now accepts a deselected argument to assert the total number of deselected tests. #9114: Added pythonpath setting that adds listed paths to sys.path for the duration of the test session. If you currently use the pytest-pythonpath or pytest-srcpaths plugins, you should be able to replace them with built-in pythonpath setting. Improvements #7480: A deprecation scheduled to be removed in a major version X (e.g. pytest 7, 8, 9, …) now uses warning category PytestRemovedInXWarning, a subclass of PytestDeprecationWarning, instead of PytestDeprecationWarning directly. See Backwards Compatibility Policy for more details. #7864: Improved error messages when parsing warning filters. Previously pytest would show an internal traceback, which besides being ugly sometimes would hide the cause of the problem (for example an ImportError while importing a specific warning type). #8335: Improved pytest.approx() assertion messages for sequences of numbers. The assertion messages now dumps a table with the index and the error of each diff. Example: > assert [1, 2, 3, 4] == pytest.approx([1, 3, 3, 5]) E assert comparison failed for 2 values: E Index | Obtained | Expected E 1 | 2 | 3 +- 3.0e-06 E 3 | 4 | 5 +- 5.0e-06 #8403: By default, pytest will truncate long strings in assert errors so they don’t clutter the output too much, currently at 240 characters by default. However, in some cases the longer output helps, or is even crucial, to diagnose a failure. Using -v will now increase the truncation threshold to 2400 characters, and -vv or higher will disable truncation entirely. #8509: Fixed issue where unittest.TestCase.setUpClass() is not called when a test has / in its name since pytest 6.2.0. This refers to the path part in pytest node IDs, e.g. TestClass::test_it in the node ID tests/test_file.py::TestClass::test_it. Now, instead of assuming that the test name does not contain /, it is assumed that test path does not contain ::. We plan to hopefully make both of these work in the future. #8803: It is now possible to add colors to custom log levels on cli log. By using add_color_level from a pytest_configure hook, colors can be added: logging_plugin = config.pluginmanager.get_plugin('logging-plugin') logging_plugin.log_cli_handler.formatter.add_color_level(logging.INFO, 'cyan') logging_plugin.log_cli_handler.formatter.add_color_level(logging.SPAM, 'blue') See Customizing Colors for more information. #8822: When showing fixture paths in --fixtures or --fixtures-by-test, fixtures coming from pytest itself now display an elided path, rather than the full path to the file in the site-packages directory. #8898: Complex numbers are now treated like floats and integers when generating parameterization IDs. #9062: --stepwise-skip now implicitly enables --stepwise and can be used on its own. #9205: pytest.Cache.set() now preserves key order when saving dicts.
python: egg.mk: add USE_PKG_RESOURCES flag This flag should be set for packages that import pkg_resources and thus need setuptools after the build step. Set this flag for packages that need it and bump PKGREVISION.
*: bump PKGREVISION for egg.mk users They now have a tool dependency on py-setuptools instead of a DEPENDS
py-test: updated to 6.2.5 pytest 6.2.5 Python 3.10 is now supported. Enable compatibility with ``pluggy 1.0`` or later.
py-test: updated to 6.2.4 pytest 6.2.4 Bug Fixes * Fixed assertion rewriting on Python 3.10.
py-test: updated to 6.2.3 pytest 6.2.3 (2021-04-03) ========================= Bug Fixes --------- - pytest used to create directories under ``/tmp`` with world-readable permissions. This means that any user in the system was able to read information written by tests in temporary directories (such as those created by the ``tmp_path``/``tmpdir`` fixture). Now the directories are created with private permissions. pytest used silenty use a pre-existing ``/tmp/pytest-of-<username>`` directory, even if owned by another user. This means another user could pre-create such a directory and gain control of another user's temporary directory. Now such a condition results in an error.
py-test: updated to 6.2.2 pytest 6.2.2 Bug Fixes - Fixed "(<Skipped instance>)" being shown as a skip reason in the verbose test summary line when the reason is empty. - Fix the ``faulthandler`` plugin for occasions when running with ``twisted.logger`` and using ``pytest --capture=no``.
py-test: updated to 6.2.1 pytest 6.2.1 Bug Fixes Fixed bug where ImportPathMismatchError would be raised for files compiled in the host and loaded later from an UNC mounted path (Windows). Fixed regression in approx: in 6.2.0 approx no longer raises TypeError when dealing with non-numeric types, falling back to normal comparison. Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case, and happened to compare correctly to a scalar if they had only one element. After 6.2.0, these types began failing, because they inherited neither from standard Python number hierarchy nor from numpy.ndarray. approx now converts arguments to numpy.ndarray if they expose the array protocol and are not scalars. This treats array-like objects like numpy arrays, regardless of size.
py-test: updated to 6.2.0 pytest 6.2.0 (2020-12-12) ========================= Breaking Changes ---------------- - pytest now supports python3.6+ only. Deprecations ------------ - Directly constructing/calling the following classes/functions is now deprecated: - ``_pytest.cacheprovider.Cache`` - ``_pytest.cacheprovider.Cache.for_config()`` - ``_pytest.cacheprovider.Cache.clear_cache()`` - ``_pytest.cacheprovider.Cache.cache_dir_from_config()`` - ``_pytest.capture.CaptureFixture`` - ``_pytest.fixtures.FixtureRequest`` - ``_pytest.fixtures.SubRequest`` - ``_pytest.logging.LogCaptureFixture`` - ``_pytest.pytester.Pytester`` - ``_pytest.pytester.Testdir`` - ``_pytest.recwarn.WarningsRecorder`` - ``_pytest.recwarn.WarningsChecker`` - ``_pytest.tmpdir.TempPathFactory`` - ``_pytest.tmpdir.TempdirFactory`` These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0. - The ``--strict`` command-line option has been deprecated, use ``--strict-markers`` instead. We have plans to maybe in the future to reintroduce ``--strict`` and make it an encompassing flag for all strictness related options (``--strict-markers`` and ``--strict-config`` at the moment, more might be introduced in the future). - The ``@pytest.yield_fixture`` decorator/function is now deprecated. Use :func:`pytest.fixture` instead. ``yield_fixture`` has been an alias for ``fixture`` for a very long time, so can be search/replaced safely. Features -------- - pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8. See :ref:`unraisable` for more information. - New :fixture:`pytester` fixture, which is identical to :fixture:`testdir` but its methods return :class:`pathlib.Path` when appropriate instead of ``py.path.local``. This is part of the movement to use :class:`pathlib.Path` objects internally, in order to remove the dependency to ``py`` in the future. Internally, the old :class:`Testdir <_pytest.pytester.Testdir>` is now a thin wrapper around :class:`Pytester <_pytest.pytester.Pytester>`, preserving the old interface. - A new hook was added, `pytest_markeval_namespace` which should return a dictionary. This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers. Pseudo example ``conftest.py``: .. code-block:: python def pytest_markeval_namespace(): return {"color": "red"} ``test_func.py``: .. code-block:: python @pytest.mark.skipif("color == 'blue'", reason="Color is not red") def test_func(): assert False - It is now possible to construct a :class:`~pytest.MonkeyPatch` object directly as ``pytest.MonkeyPatch()``, in cases when the :fixture:`monkeypatch` fixture cannot be used. Previously some users imported it from the private `_pytest.monkeypatch.MonkeyPatch` namespace. Additionally, :meth:`MonkeyPatch.context <pytest.MonkeyPatch.context>` is now a classmethod, and can be used as ``with MonkeyPatch.context() as mp: ...``. This is the recommended way to use ``MonkeyPatch`` directly, since unlike the ``monkeypatch`` fixture, an instance created directly is not ``undo()``-ed automatically. Improvements ------------ - Added an ``__str__`` implementation to the :class:`~pytest.pytester.LineMatcher` class which is returned from ``pytester.run_pytest().stdout`` and similar. It returns the entire output, like the existing ``str()`` method. - Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS". - The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions. The newly-exported types are: - ``pytest.FixtureRequest`` for the :fixture:`request` fixture. - ``pytest.Cache`` for the :fixture:`cache` fixture. - ``pytest.CaptureFixture[str]`` for the :fixture:`capfd` and :fixture:`capsys` fixtures. - ``pytest.CaptureFixture[bytes]`` for the :fixture:`capfdbinary` and :fixture:`capsysbinary` fixtures. - ``pytest.LogCaptureFixture`` for the :fixture:`caplog` fixture. - ``pytest.Pytester`` for the :fixture:`pytester` fixture. - ``pytest.Testdir`` for the :fixture:`testdir` fixture. - ``pytest.TempdirFactory`` for the :fixture:`tmpdir_factory` fixture. - ``pytest.TempPathFactory`` for the :fixture:`tmp_path_factory` fixture. - ``pytest.MonkeyPatch`` for the :fixture:`monkeypatch` fixture. - ``pytest.WarningsRecorder`` for the :fixture:`recwarn` fixture. Constructing them is not supported (except for `MonkeyPatch`); they are only meant for use in type annotations. Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0. Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy. - When a comparison between :func:`namedtuple <collections.namedtuple>` instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes. - :meth:`Node.warn <_pytest.nodes.Node.warn>` now permits any subclass of :class:`Warning`, not just :class:`PytestWarning <pytest.PytestWarning>`. - Improved reporting when using ``--collected-only``. It will now show the number of collected tests in the summary stats. - Use strict equality comparison for non-numeric types in :func:`pytest.approx` instead of raising :class:`TypeError`. This was the undocumented behavior before 3.7, but is now officially a supported feature. - New ``--sw-skip`` argument which is a shorthand for ``--stepwise-skip``. - Added ``'node_modules'`` to default value for :confval:`norecursedirs`. - :meth:`doClassCleanups <unittest.TestCase.doClassCleanups>` (introduced in :mod:`unittest` in Python and 3.8) is now called appropriately. Bug Fixes --------- - Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures. - Fixed an issue where some files in packages are getting lost from ``--lf`` even though they contain tests that failed. Regressed in pytest 5.4.0. - Directories created by by :fixture:`tmp_path` and :fixture:`tmpdir` are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. - Fixed a crash or hang in :meth:`pytester.spawn <_pytest.pytester.Pytester.spawn>` when the :mod:`readline` module is involved. - Fixed handling of recursive symlinks when collecting tests. - Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0. - Fixed only one doctest being collected when using ``pytest --doctest-modules path/to/an/__init__.py``. Improved Documentation ---------------------- - Add more information and use cases about skipping doctests. - Classes which should not be inherited from are now marked ``final class`` in the API reference. - ``_pytest.config.argparsing.Parser.addini()`` accepts explicit ``None`` and ``"string"``. - In pull request section, ask to commit after editing changelog and authors file. Trivial/Internal Changes ------------------------ - The ``attrs`` dependency requirement is now >=19.2.0 instead of >=17.4.0. - `.pyc` files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7. (These files are internal and only interpreted by pytest itself.)
py-test: updated to 6.1.2 pytest 6.1.2 Bug Fixes * Fixed an issue where some files in packages are getting lost from --lf even though they contain tests that failed. Regressed in pytest 5.4.0. * Directories created by tmpdir are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites. Improved Documentation * Improve deprecation warning message for pytest._fillfuncargs().
py-test: updated to 6.1.1 pytest 6.1.1 (2020-10-03) ========================= Bug Fixes --------- - 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. - Fixed crash in header reporting when :confval:`testpaths` is used and contains absolute paths (regression in 6.1.0). pytest 6.1.0 (2020-09-26) ========================= Breaking Changes ---------------- - As per our policy, the following features which have been deprecated in the 5.X series are now removed: * The ``funcargnames`` read-only property of ``FixtureRequest``, ``Metafunc``, and ``Function`` classes. Use ``fixturenames`` attribute. * ``@pytest.fixture`` no longer supports positional arguments, pass all arguments by keyword instead. * Direct construction of ``Node`` subclasses now raise an error, use ``from_parent`` instead. * The default value for ``junit_family`` has changed to ``xunit2``. If you require the old format, add ``junit_family=xunit1`` to your configuration file. * 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. * The ``--result-log`` option has been removed. Users are recommended to use the `pytest-reportlog <https://github.com/pytest-dev/pytest-reportlog>`__ plugin instead. For more information consult `Deprecations and Removals <https://docs.pytest.org/en/stable/deprecations.html>`__ in the docs. Deprecations ------------ - The ``pytest.collect`` module is deprecated: all its names can be imported from ``pytest`` directly. - The ``pytest._fillfuncargs`` function is deprecated. This function was kept for backward compatibility with an older plugin. It's functionality is not meant to be used directly, but if you must replace it, use `function._request._fillfixtures()` instead, though note this is not a public API and may break in the future. - The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` instead. The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue if you use this and want a replacement. - The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version. - The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated; use ``self.session.gethookproxy()`` and ``self.session.isinitpath()`` instead. This should work on all pytest versions. Features -------- - 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``. Improvements ------------ - Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through :confval:`filterwarnings` or ``--pythonwarnings/-W``. - 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. - Added two new attributes :attr:`rootpath <_pytest.config.Config.rootpath>` and :attr:`inipath <_pytest.config.Config.inipath>` to :class:`Config <_pytest.config.Config>`. These attributes are :class:`pathlib.Path` versions of the existing :attr:`rootdir <_pytest.config.Config.rootdir>` and :attr:`inifile <_pytest.config.Config.inifile>` attributes, and should be preferred over them when possible. - Public classes which are not designed to be inherited from are now marked `@final <https://docs.python.org/3/library/typing.html#typing.final>`_. Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime. Currently the ``final`` designation does not appear in the API Reference but hopefully will in the future. Bug Fixes --------- - Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value. .. code-block:: python # conftest.py import pytest @pytest.fixture(params=[1, 2]) def foo(request): return request.param # test_foo.py import pytest @pytest.fixture def foo(foo): return foo * 2 - Fixed an internal error crash with ``IndexError: list index out of range`` when collecting a module which starts with a decorated function, the decorator raises, and assertion rewriting is enabled. - pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from :ref:`File <non-python tests>`. - 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``). - 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``. - Fixed INTERNALERROR when accessing locals / globals with faulty ``exec``. Improved Documentation ---------------------- - Removed faq.rst and its reference in contents.rst. Trivial/Internal Changes ------------------------ - The internal ``junitxml`` plugin has rewritten to use ``xml.etree.ElementTree``. The order of attributes in XML elements might differ. Some unneeded escaping is no longer performed. - The dependency on the ``more-itertools`` package has been removed. - The result type of :meth:`capfd.readouterr() <_pytest.capture.CaptureFixture.readouterr>` (and similar) is no longer a namedtuple, but should behave like one in all respects. This was done for technical reasons. - When collecting tests, pytest finds test classes and functions by examining the attributes of python objects (modules, classes and instances). To speed up this process, pytest now ignores builtin attributes (like ``__class__``, ``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and :confval:`python_functions` configuration options and without passing them to plugins using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook.
py-test: updated to 6.0.2 pytest 6.0.2 Bug Fixes * Fixed --log-cli potentially causing unrelated print output to be swallowed. * Fixed log-capturing level restored incorrectly if caplog.set_level is called more than once. * Fixed NotSetType.token being used as the parameter ID when the parametrization list is empty. Regressed in pytest 6.0.0. * Fix internal error when handling some exceptions that contain multiple lines or the style uses multiple lines (--tb=line for example).
devel/py-test: Back out previous. Apparently a package cannot TEST_DEPENDS on itself, even if it is necessary in order for make test to work. The TEST_DEPENDS mechanism seems like it could maybe use some work.
devel/py-test: Needs itself installed to run its own tests.
py-test: updated to 6.0.1 pytest 6.0.1 Bug Fixes * Passing an empty help value to Parser.add_option is now accepted instead of crashing when running pytest --help. Passing None raises a more informative TypeError. * Fix pylint not-callable lint on pytest.mark.parametrize() and the other builtin marks: skip, skipif, xfail, usefixtures, filterwarnings. * Fix regression in plugins using TestReport.longreprtext (such as pytest-html) when TestReport.longrepr is not a string. * Fix logging capture handler's level not reset on teardown after a call to caplog.set_level(). pytest 6.0.0 (Please see the full set of changes for this release also in the 6.0.0rc1 notes below) Breaking Changes * PytestDeprecationWarning are now errors by default. Following our plan to remove deprecated features with as little disruption as possible, all warnings of type PytestDeprecationWarning now generate errors instead of warning messages. The affected features will be effectively removed in pytest 6.1, so please consult the Deprecations and Removals section in the docs for directions on how to update existing code. In the pytest 6.0.X series, it is possible to change the errors back into warnings as a stopgap measure by adding this to your pytest.ini file: [pytest] filterwarnings = ignore::pytest.PytestDeprecationWarning But this will stop working when pytest 6.1 is released. * The exec_() and is_true() methods of _pytest._code.Frame have been removed. Features * Added support for :envvar:`NO_COLOR` and :envvar:`FORCE_COLOR` environment variables to control colored output. Improvements * --log-file CLI option and log_file ini marker now create subdirectories if needed. * 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. Bug Fixes * Fix the reported location of tests skipped with @pytest.mark.skip when --runxfail is used. * :fixture:`tmpdir` and :fixture:`tmp_path` no longer raise an error if the lock to check for stale temporary directories is not accessible. * Preserve line endings when captured via capfd. * Restored the previous formatting of TracebackEntry.__str__ which was changed by accident. Improved Documentation * Clarified when the usefixtures mark can apply fixtures to test. * Add a note about -q option used in getting started guide. Trivial/Internal Changes * Fixture scope package is no longer considered experimental. pytest 6.0.0rc1 Breaking Changes * TestReport.longrepr is now always an instance of ReprExceptionInfo. Previously it was a str when a test failed with pytest.fail(..., pytrace=False). * symlinks are no longer resolved during collection and matching conftest.py files with test file paths. 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. This might break test suites which made use of this feature; the fix is to create a symlink for the entire test tree, and not only to partial files/tress as it was possible previously. * Testdir.run().parseoutcomes() now always returns the parsed nouns in plural form. Originally parseoutcomes() would always returns the nouns in plural form, but a change meant to improve the terminal summary by using singular form single items (1 warning or 1 error) caused an unintended regression by changing the keys returned by parseoutcomes(). Now the API guarantees to always return the plural form, so calls like this: result = testdir.runpytest() result.assert_outcomes(error=1) Need to be changed to: result = testdir.runpytest() result.assert_outcomes(errors=1) * The os.dup() function is now assumed to exist. We are not aware of any supported Python 3 implementations which do not provide it. * -k no longer matches against the names of the directories outside the test session root. Also, pytest.Package.name is now just the name of the directory containing the package's __init__.py file, instead of the full path. This is consistent with how the other nodes are named, and also one of the reasons why -k would match against any directory containing the test suite. * Expressions given to the -m and -k options are no longer evaluated using Python's :func:`eval`. The format supports or, and, not, parenthesis and general identifiers to match against. Python constants, keywords or other operators are no longer evaluated differently. * Pytest now uses its own TerminalWriter class instead of using the one from the py library. Plugins generally access this class through TerminalReporter.writer, TerminalReporter.write() (and similar methods), or _pytest.config.create_terminal_writer(). The following breaking changes were made: Output (write() method and others) no longer flush implicitly; the flushing behavior of the underlying file is respected. To flush explicitly (for example, if you want output to be shown before an end-of-line is printed), use write(flush=True) or terminal_writer.flush(). Explicit Windows console support was removed, delegated to the colorama library. Support for writing bytes was removed. The reline method and chars_on_current_line property were removed. The stringio and encoding arguments was removed. Support for passing a callable instead of a file was removed. * The item.catch_log_handler and item.catch_log_handlers attributes, set by the logging plugin and never meant to be public, are no longer available. The deprecated --no-print-logs option and log_print ini option are removed. Use --show-capture instead. * Removed the unused args parameter from pytest.Function.__init__. * Removed the pytest_doctest_prepare_content hook specification. This hook hasn't been triggered by pytest for at least 10 years. * Some changes were made to the internal _pytest._code.source, listed here for the benefit of plugin authors who may be using it: The deindent argument to Source() has been removed, now it is always true. Support for zero or multiple arguments to Source() has been removed. Support for comparing Source with an str has been removed. The methods Source.isparseable() and Source.putaround() have been removed. The method Source.compile() and function _pytest._code.compile() have been removed; use plain compile() instead. The function _pytest._code.source.getsource() has been removed; use Source() directly instead. Deprecations * The special -k '-expr' syntax to -k is deprecated. Use -k 'not expr' instead. The special -k 'expr:' syntax to -k is deprecated. Please open an issue if you use this and want a replacement. * pytest_warning_captured is deprecated in favor of the pytest_warning_recorded hook. Features * pytest now supports pyproject.toml files for configuration. The configuration options is similar to the one available in other formats, but must be defined in a [tool.pytest.ini_options] table to be picked up by pytest: # pyproject.toml [tool.pytest.ini_options] minversion = "6.0" addopts = "-ra -q" testpaths = [ "tests", "integration", ] More information can be found in the docs. * pytest now includes inline type annotations and exposes them to user programs. Most of the user-facing API is covered, as well as internal code. If you are running a type checker such as mypy on your tests, you may start noticing type errors indicating incorrect usage. If you run into an error that you believe to be incorrect, please let us know in an issue. The types were developed against mypy version 0.780. Versions before 0.750 are known not to work. We recommend using the latest version. Other type checkers may work as well, but they are not officially verified to work by pytest yet. * Introduced a new hook named pytest_warning_recorded to convey information about warnings captured by the internal pytest warnings plugin. This hook is meant to replace pytest_warning_captured, which is deprecated and will be removed in a future release. * New command-line flags: --no-header: disables the initial header, including platform, version, and plugins. --no-summary: disables the final test summary, including warnings. * A warning is now shown when an unknown key is read from a config INI file. The --strict-config flag has been added to treat these warnings as errors. * Added --code-highlight command line option to enable/disable code highlighting in terminal output. * New --import-mode=importlib option that uses importlib to import test modules. Traditionally pytest used __import__ while changing sys.path to import test modules (which also changes sys.modules as a side-effect), which works but has a number of drawbacks, like requiring test modules that don't live in packages to have unique names (as they need to reside under a unique name in sys.modules). --import-mode=importlib uses more fine grained import mechanisms from importlib which don't require pytest to change sys.path or sys.modules at all, eliminating much of the drawbacks of the previous mode. You can read more about this option in the documentation. * 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. Improvements * The pytest command now suppresses the BrokenPipeError error message that is printed to stderr when the output of pytest is piped and and the pipe is closed by the piped-to program (common examples are less and head). * 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()). * Rich comparison for dataclasses and attrs-classes is now recursive. * Exposed the pytest.FixtureLookupError exception which is raised by request.getfixturevalue() (where request is a FixtureRequest fixture) when a fixture with the given name cannot be returned. * If an error is encountered while formatting the message in a logging call, for example logging.warning("oh no!: %s: %s", "first") (a second argument is missing), pytest now propagates the error, likely causing the test to fail. Previously, such a mistake would cause an error to be printed to stderr, which is not displayed by default for passing tests. This change makes the mistake visible during testing. You may supress this behavior temporarily or permanently by setting logging.raiseExceptions = False. * Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control of the help displayed to users. * When using the --duration option, the terminal message output is now more precise about the number and duration of hidden items. * Collected files are displayed after any reports from hooks, e.g. the status from --lf. * When fd capturing is used, through --capture=fd or the capfd and capfdbinary fixtures, and the file descriptor (0, 1, 2) cannot be duplicated, FD capturing is still performed. Previously, direct writes to the file descriptors would fail or be lost in this case. * Exit with an error if the --basetemp argument is empty, is the current working directory or is one of the parent directories. This is done to protect against accidental data loss, as any directory passed to this argument is cleared. * 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. * :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` will now override any :confval:`log_level` set via the CLI or configuration file. * :meth:`caplog.set_level() <_pytest.logging.LogCaptureFixture.set_level>` and :meth:`caplog.at_level() <_pytest.logging.LogCaptureFixture.at_level>` no longer affect the level of logs that are shown in the Captured log report report section. * Improve recursive diff report for comparison asserts on dataclasses / attrs. * --junitxml now includes the exception cause in the message XML attribute for failures during setup and teardown. Previously: <error message="test setup failure"> Now: <error message="failed on setup with "ValueError: Some error during setup""> Bug Fixes * Fix issue where directories from :fixture:`tmpdir` are not removed properly when multiple instances of pytest are running in parallel. * Prevent crashing and provide a user-friendly error when a marker expression (-m) invoking of :func:`eval` raises any exception. * The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. * Fix a possible race condition when trying to remove lock files used to control access to folders created by :fixture:`tmp_path` and :fixture:`tmpdir`. * Fixes an issue where logging during collection step caused duplication of log messages to stderr. * Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. * Support deleting paths longer than 260 characters on windows created inside :fixture:`tmpdir`. * Fix crash with captured output when using :fixture:`capsysbinary`. * Revert the change introduced by 6330, which required all arguments to @pytest.mark.parametrize to be explicitly defined in the function signature. 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. * Fix crash when plugins return an unknown stats while using the --reportlog option. * Ensure a unittest.IsolatedAsyncioTestCase is actually awaited. * Fix TerminalRepr instances to be hashable again. * Fix regression where functions registered with :meth:`unittest.TestCase.addCleanup` were not being called on test failures. * Allow users to still set the deprecated TerminalReporter.writer attribute. * Prevent pytest from printing ConftestImportFailure traceback to stdout. * Fix regressions with --lf filtering too much since pytest 5.4. * Revert "tmpdir: clean up indirection via config for factories" 6767 as it breaks pytest-xdist. * When a yielding fixture fails to yield a value, report a test setup error instead of crashing. * 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. * Fixed regression: asyncbase.TestCase tests are executed correctly again. * --setup-show now doesn't raise an error when a bytes value is used as a parametrize parameter when Python is called with the -bb flag. * Fix :meth:`pytest.File.from_parent` so it forwards extra keyword arguments to the constructor. * Classes with broken __getattribute__ methods are displayed correctly during failures. * Prevent hiding the underlying exception when ConfTestImportFailure is raised. * Fix _is_setup_py for files encoded differently than locale. * Fix regression where running with --pdb would call :meth:`unittest.TestCase.tearDown` for skipped tests. * When using pytest.fixture on a function directly, as in pytest.fixture(func), if the autouse or params arguments are also passed, the function is no longer ignored, but is marked as a fixture. * Fix possibly incorrect evaluation of string expressions passed to pytest.mark.skipif and pytest.mark.xfail, in rare circumstances where the exact same string is used but refers to different global values. * Fixed exception causes all over the codebase, i.e. use raise new_exception from old_exception when wrapping an exception. Improved Documentation * The development guide now links to the contributing section of the docs and RELEASING.rst on GitHub. * Add a note about --strict and --strict-markers and the preference for the latter one. * Explain indirect parametrization and markers for fixtures. Trivial/Internal Changes * The originalname attribute of _pytest.python.Function now defaults to name if not provided explicitly, and is always set. * The dependency on the wcwidth package has been removed. * Replaced py.iniconfig with iniconfig. * src/_pytest/config/__init__.py now uses the warnings module to report warnings instead of sys.stderr.write. * Remove last internal uses of deprecated slave term from old pytest-xdist. * py>=1.8.2 is now required.
py-test: updated to 5.4.3 pytest 5.4.3: Bug Fixes * Paths appearing in error messages are now correct in case the current working directory has changed since the start of the session. * Support deleting paths longer than 260 characters on windows created inside tmpdir. * Prevent pytest from printing ConftestImportFailure traceback to stdout. * Prevent hiding the underlying exception when ConfTestImportFailure is raised. * Fix regression where running with --pdb would call the tearDown methods of unittest.TestCase subclasses for skipped tests.
Make explicit python version test more robust. Now if you come here looking for python27 it fails properly instead of throwing a make syntax error.
py-test: updated to 5.4.2 pytest 5.4.2: Bug Fixes * Fix crash with captured output when using the capsysbinary fixture. * Ensure a unittest.IsolatedAsyncioTestCase is actually awaited. * Fix TerminalRepr instances to be hashable again. * Fix regression where functions registered with TestCase.addCleanup were not being called on test failures. * Allow users to still set the deprecated TerminalReporter.writer attribute. * Revert “tmpdir: clean up indirection via config for factories” 6767 as it breaks pytest-xdist. * Fixed regression: asyncbase.TestCase tests are executed correctly again. * Fix File.from_constructor so it forwards extra keyword arguments to the constructor. * Classes with broken __getattribute__ methods are displayed correctly during failures. * Fix _is_setup_py for files encoded differently than locale. pytest 5.4.1: Bug Fixes * Revert the change introduced by 6330, which required all arguments to @pytest.mark.parametrize to be explicitly defined in the function signature. 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. * Fix crash when plugins return an unknown stats while using the --reportlog option. pytest 5.4.0: Breaking Changes * Matching of -k EXPRESSION to test names is now case-insensitive. * Plugins specified with -p are now loaded after internal plugins, which results in their hooks being called before the internal ones. This makes the -p behavior consistent with PYTEST_PLUGINS. * Removed the long-deprecated pytest_itemstart hook. This hook has been marked as deprecated and not been even called by pytest for over 10 years now. * 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. * The cached_result attribute of FixtureDef is now set to None when the result is unavailable, instead of being deleted. If your plugin performs checks like hasattr(fixturedef, 'cached_result'), for example in a pytest_fixture_post_finalizer hook implementation, replace it with fixturedef.cached_result is not None. If you del the attribute, set it to None instead. Deprecations * 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 provide feedback. --show-capture command-line option was added in pytest 3.5.0 and allows to specify how to display captured output when tests fail: no, stdout, stderr, log or all (the default). * Deprecate the unused/broken pytest_collect_directory hook. It was misaligned since the removal of the Directory collector in 2010 and incorrect/unusable as soon as collection was split from test execution. * Deprecate using direct constructors for Nodes. Instead they are now constructed via Node.from_parent. This transitional mechanism enables us to untangle the very intensely entangled Node relationships by enforcing more controlled creation/configuration patterns. 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. Subclasses are expected to use super().from_parent if they intend to expand the creation of Nodes. * The TerminalReporter.writer attribute has been deprecated and should no longer be used. This was inadvertently exposed as part of the public API of that plugin and ties it too much with py.io.TerminalWriter. Features * New –capture=tee-sys option to allow both live printing and capturing of test output. * Now all arguments to @pytest.mark.parametrize need to be explicitly declared in the function signature or via indirect. 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. * Changed default for -r to fE, which displays failures and errors in the short test summary. -rN can be used to disable it (the old behavior). * New options have been added to the junit_logging option: log, out-err, and all. * Excess warning summaries are now collapsed per file to ensure readable display of warning summaries. Improvements * pytest.mark.parametrize accepts integers for ids again, converting it to strings. * Use “yellow” main color with any XPASSED tests. * Revert “A warning is now issued when assertions are made for None”. The warning proved to be less useful than initially expected and had quite a few false positive cases. * tmpdir_factory.mktemp now fails when given absolute and non-normalized paths. * The pytest_warning_captured hook now receives a location parameter with the code location that generated the warning. * pytester: the testdir fixture respects environment settings from the monkeypatch fixture for inner runs. * --fulltrace is honored with collection errors. * Make --showlocals work also with --tb=short. * Add support for matching lines consecutively with LineMatcher’s fnmatch_lines() and re_match_lines(). * Code is now highlighted in tracebacks when pygments is installed. Users are encouraged to install pygments into their environment and provide feedback, because the plan is to make pygments a regular dependency in the future. * Import usage error message with invalid -o option. * pytest.mark.parametrize supports iterators and generators for ids. Bug Fixes * Add support for calling pytest.xfail() and pytest.importorskip() with doctests. * --trace now works with unittests. * Fixed some warning reports produced by pytest to point to the correct location of the warning in the user’s code. * Fix --last-failed to collect new tests from files with known failures. * Report PytestUnknownMarkWarning at the level of the user’s code, not pytest’s. * Fix interaction with --pdb and unittests: do not use unittest’s TestCase.debug(). * 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). The upper case variants were never documented and the preferred form should be the lower case. * Fallback to green (instead of yellow) for non-last items without previous passes with colored terminal progress indicator. * --disable-warnings is honored with -ra and -rA. * Fix bug in the comparison of request key with cached key in fixture. 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. The implemented fix replaces == with is. * Make capture output streams .write() method return the same return value from original streams. * Fix EncodedFile.writelines to call the underlying buffer’s writelines method. * Fix internal crash when faulthandler starts initialized (for example with PYTHONFAULTHANDLER=1 environment variable set) and faulthandler_timeout defined in the configuration file. * Fix node ids which contain a parametrized empty-string variable. * Assertion rewriting hooks are (re)stored for the current item, which fixes them being still used after e.g. pytester’s testdir.runpytest etc. * pytest.exit() is handled when emitted from the pytest_sessionfinish hook. This includes quitting from a debugger. * When pytest.raises() is used as a function (as opposed to a context manager), a match keyword argument is now passed through to the tested function. Previously it was swallowed and ignored (regression in pytest 5.1.0). * Do not display empty lines inbetween traceback for unexpected exceptions with doctests. * The testdir fixture works within doctests now. Improved Documentation * Add list of fixtures to start of fixture chapter. * Expand first sentence on fixtures into a paragraph. Trivial/Internal Changes * Remove usage of parser module, deprecated in Python 3.9.
mk.mk? mk.
*: use py-more-itertools via versioned_dependencies.mk
py-test: updated to 4.6.6 pytest 4.6.6: Bug Fixes * Fixed using multiple short options together in the command-line (for example -vs) in Python 3.8+. * Replace importlib_metadata backport with importlib.metadata from the standard library on Python 3.8+. * Fix “lexer” being used when uploading to bpaste.net from --pastebin to “text”. * Fix warnings about deprecated cmp attribute in attrs>=19.2. Trivial/Internal Changes * Fixes python version checks (detected by flake8-2020) in case python4 becomes a thing.
py-test: updated to 4.6.5 pytest 4.6.5: Bug Fixes * Fix RuntimeError/StopIteration when trying to collect package with “__init__.py” only. * Fix encode error when using unicode strings in exceptions with pytest.raises. * Fix issue where tmp_path and tmpdir would not remove directories containing files marked as read-only, which could lead to pytest crashing when executed a second time with the --basetemp option. * --step-wise now handles xfail(strict=True) markers properly. * Improved output when parsing an ini configuration file fails. pytest 4.6.4: Bug Fixes * Emit a warning when attempting to unwrap a broken object raises an exception, for easier debugging. * Fix --stepwise mode when the first file passed on the command-line fails to collect. * Fix bug introduced in 4.6.0 causing collection errors when passing more than 2 positional arguments to pytest.mark.parametrize. * Fix crash when discovery fails while using -p no:terminal.
py-test: update to 4.6.3nb1. From the 4.5.0 changelog: - pytest now depends on wcwidth Make it so.
py-test: updated to 4.6.3 pytest 4.6.3: Bug Fixes * -q has again an impact on the style of the collected items (--collect-only) when --log-cli-level is used. * Fix regressions of 5063 for importlib_metadata.PathDistribution which have their files attribute being None. * Fix regression where the obj attribute of TestCase items was no longer bound to methods.
py-test: updated to 4.6.2 pytest 4.6.2: Bug Fixes * Revert unrolling of all() to fix NameError on nested comprehensions. * Revert unrolling of all() to fix incorrect handling of generators with if. * Revert unrolling of all() to fix incorrect assertion when using all() in an expression
py-test: updated to 4.6.1 pytest 4.6.1: Bug Fixes * Fix pytest.mark.parametrize when the argvalues is an iterator. * Fix assertion rewriting of all() calls to deal with non-generators.
py-test: updated to 4.6.0 pytest 4.6.0: Important The 4.6.X series will be the last series to support Python 2 and Python 3.4. Features * 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. * pytester’s testdir.spawn uses tmpdir as HOME/USERPROFILE directory. * Unroll calls to all to full for-loops with assertion rewriting for better failure messages, especially when using Generator Expressions. * Switch from pkg_resources to importlib-metadata for entrypoint detection for improved performance and import time. * The output for ini options in --help has been improved. * pytest.importorskip includes the ImportError now in the default reason. * Captured logs that are output for each failing test are formatted using the ColoredLevelFormatter. * Improved formatting of multiline log messages in Python 3. Bug Fixes * The debugging plugin imports the wrapped Pdb class (--pdbcls) on-demand now. * The pytest_enter_pdb hook gets called with post-mortem (--pdb). * Fix issue where fixtures dependent on other parametrized fixtures would be erroneously parametrized. * Handle internal error due to a lone surrogate unicode character not being representable in Jython. * Ensure that sys.stdout.mode does not include 'b' as it is a text stream. * Pytest’s internal python plugin can be disabled using -p no:python again. * 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. * Show the test module being collected when emitting PytestCollectionWarning messages for test classes with __init__ and __new__ methods to make it easier to pin down the problem. * Fix regression in 4.5.0 with --lf not re-running all tests with known failures from non-selected tests. Improved Documentation * Expand docs on use of setenv and delenv with monkeypatch.
py-test: updated to 4.5.0 pytest 4.5.0: Features - A warning is now emitted when unknown marks are used as a decorator. This is often due to a typo, which can lead to silently broken tests. - Show XFail reason as part of JUnitXML message field. - Messages from crash reports are displayed within test summaries now, truncated to the terminal width. - 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. The existing --strict option has the same behavior currently, but can be augmented in the future for additional checks. - Assertion failure messages for sequences and dicts contain the number of different items now. - Improve reporting with --lf and --ff (run-last-failure). - The --cache-show option/action accepts an optional glob to show only matching cache entries. - Standard input (stdin) can be given to pytester's Testdir.run() and Testdir.popen(). - The -r option learnt about A to display all reports (including passed ones) in the short test summary. - The short test summary is displayed after passes with output (-rP). - The --last-failed (--lf) option got smarter and will now skip entire files if all tests of that test file have passed in previous runs, greatly speeding up collection. - 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: * PytestAssertRewriteWarning * PytestCacheWarning * PytestCollectionWarning * PytestConfigWarning * PytestUnhandledCoroutineWarning * PytestUnknownMarkWarning - New record_testsuite_property session-scoped fixture allows users to log <property> tags at the testsuite level with the junitxml plugin. The generated XML is compatible with the latest xunit standard, contrary to the properties recorded by record_property and record_xml_attribute. - The default logging format has been changed to improve readability. Here is an example of a previous logging message:: test_log_cli_enabled_disabled.py 3 CRITICAL critical message logged by test This has now become:: CRITICAL root:test_log_cli_enabled_disabled.py:3 critical message logged by test The formatting can be changed through the log_format <https://docs.pytest.org/en/latest/reference.html#confval-log_format>__ configuration option. - --fixtures now also shows fixture scope for scopes other than "function". Bug Fixes - Deselected items from plugins using pytest_collect_modifyitems as a hookwrapper are correctly reported now. - With usage errors exitstatus is set to EXIT_USAGEERROR in the pytest_sessionfinish hook now as expected. - outcome.exit is not used with EOF in the pdb wrapper anymore, but only with quit. Improved Documentation - Expand docs on registering marks and the effect of --strict. Trivial/Internal Changes - logging.raiseExceptions is not set to False anymore. - pytest now depends on wcwidth <https://pypi.org/project/wcwidth>__ to properly track unicode character sizes for more precise terminal output. - pytester's Testdir.popen() uses stdout and stderr via keyword arguments with defaults now (subprocess.PIPE). - The code for the short test summary in the terminal was moved to the terminal plugin. - Improved validation of kwargs for various methods in the pytester plugin. - record_property now emits a PytestWarning when used with junit_family=xunit2: the fixture generates property tags as children of testcase, which is not permitted according to the most recent schema <https://github.com/jenkinsci/xunit-plugin/blob/master/ src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd>__. - Pin pluggy to < 1.0 so we don't update to 1.0 automatically when it gets released: there are planned breaking changes, and we want to ensure pytest properly supports pluggy 1.0.
py-test: updated to 4.4.2 pytest 4.4.2: Bug Fixes * Fix crash caused by error in __repr__ function with both showlocals and verbose output enabled. * Eliminate core dependency on ‘terminal’ plugin. * Require pluggy>=0.11.0 which reverts a dependency to importlib-metadata added in 0.10.0. The importlib-metadata package cannot be imported when installed as an egg and causes issues when relying on setup.py to install test dependencies. Improved Documentation * 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 * Improve help for --runxfail flag. Trivial/Internal Changes * Removed internal and unused _pytest.deprecated.MARK_INFO_ATTRIBUTE.
py-test: updated to 4.4.1 pytest 4.4.1: Bug Fixes * Environment variables are properly restored when using pytester’s testdir fixture. * Fix regression with --pdbcls, which stopped working with local modules in 4.0.0. * Produce a warning when unknown keywords are passed to pytest.param(...). * Invalidate import caches with monkeypatch.syspath_prepend, which is required with namespace packages being used.
py-test: updated to 4.4.0 pytest 4.4.0: Features * async test functions are skipped and a warning is emitted when a suitable async plugin is not installed (such as pytest-asyncio or pytest-trio). Previously async functions would not execute at all but still be marked as “passed”. * 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. * The -p option can now be used to early-load plugins also by entry-point name, instead of just by module name. This makes it possible to early load external plugins like pytest-cov in the command-line: pytest -p pytest_cov * The --pdbcls option handles classes via module attributes now (e.g. pdb:pdb.Pdb with pdb++), and its validation was improved. * The testpaths configuration option is now displayed next to the rootdir and inifile lines in the pytest header if the option is in effect, i.e., directories or file names were not explicitly passed in the command line. Also, inifile is only displayed if there’s a configuration file, instead of an empty inifile: string. * Doctests can be skipped now dynamically using pytest.skip(). * Internal refactorings have been made in order to make the implementation of the pytest-subtests plugin possible, which adds unittest sub-test support and a new subtests fixture as discussed in 1367. For details on the internal refactorings, please see the details on the related PR. * pytester’s LineMatcher asserts that the passed lines are a sequence. * Handle -p plug after -p no:plug. This can be used to override a blocked plugin (e.g. in “addopts”) from the command line etc. * Output capturing is handled correctly when only capturing via fixtures (capsys, capfs) with pdb.set_trace(). * pytester sets $HOME and $USERPROFILE to the temporary directory during test runs. This ensures to not load configuration files from the real user’s home directory. * Namespace packages are handled better with monkeypatch.syspath_prepend and testdir.syspathinsert (via pkg_resources.fixup_namespace_packages). * The stepwise plugin reports status information now. * 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. This makes it simpler for plugins to support old pytest versions. Bug Fixes * Fix bug where fixtures requested dynamically via request.getfixturevalue() might be teardown before the requesting fixture. * pytester unsets PYTEST_ADDOPTS now to not use outer options with testdir.runpytest(). * Use the correct modified time for years after 2038 in rewritten .pyc files. * Fix line offsets with ScopeMismatch errors. * -p no:plugin is handled correctly for default (internal) plugins now, e.g. with -p no:capture. Previously they were loaded (imported) always, making e.g. the capfd fixture available. * The pdb quit command is handled properly when used after the debug command with pdb++. * Fix the interpretation of -qq option where it was being considered as -v instead. * outcomes.Exit is not swallowed in assertrepr_compare anymore. * Close logging’s file handler explicitly when the session finishes. * Fix line offset with mark collection error (off by one). Improved Documentation * Update docs for pytest_cmdline_parse hook to note availability liminations Trivial/Internal Changes * pluggy>=0.9 is now required. * funcsigs>=1.0 is now required for Python 2.7. * Some left-over internal code related to yield tests has been removed. * Remove internally unused anypython fixture from the pytester plugin. * Remove deprecated Sphinx directive, add_description_unit(), pin sphinx-removed-in to >= 0.2.0 to support Sphinx 2.0. * Fix pytest tests invocation with custom PYTHONPATH. * New pytest_report_to_serializable and pytest_report_from_serializable experimental hooks. These hooks will be used by pytest-xdist, pytest-subtests, and the replacement for resultlog to serialize and customize reports. They are experimental, meaning that their details might change or even be removed completely in future patch releases without warning. Feedback is welcome from plugin authors and users alike. * Collector.repr_failure respects the --tb option, but only defaults to short now (with auto).
py-test: updated to 4.3.1 pytest 4.3.1: Bug Fixes - Logging messages inside pytest_runtest_logreport() are now properly captured and displayed. - Improve validation of contents written to captured output so it behaves the same as when capture is disabled. - Fix AttributeError: FixtureRequest has no 'confg' attribute bug in testdir.copy_example. Trivial/Internal Changes - Avoid pkg_resources import at the top-level.
py-test: updated to 4.3.0 pytest 4.3.0: Deprecations * pytest.warns() now emits a warning when it receives unknown keyword arguments. This will be changed into an error in the future. Features * Usage errors from argparse are mapped to pytest’s UsageError. * Add the --ignore-glob parameter to exclude test-modules with Unix shell-style wildcards. Add the collect_ignore_glob for conftest.py to exclude test-modules with Unix shell-style wildcards. * The warning about Python 2.7 and 3.4 not being supported in pytest 5.0 has been removed. In the end it was considered to be more of a nuisance than actual utility and users of those Python versions shouldn’t have problems as pip will not install pytest 5.0 on those interpreters. * With the help of new set_log_path() method there is a way to set log_file paths from hooks. Bug Fixes * --help and --version are handled with UsageError. * Fix AssertionError with collection of broken symlinks with packages.
py-test: updated to 4.2.1 pytest 4.2.1: Bug Fixes - The pytest_report_collectionfinish hook now is also called with --collect-only. - Do not raise UsageError when an imported package has a pytest_plugins.py child module. - Fix output capturing when using pdb++ with recursive debugging. - Fix handling of collect_ignore via parent conftest.py. - Fix regression where setUpClass would always be called in subclasses even if all tests were skipped by a unittest.skip() decorator applied in the subclass. - Fix parametrize(... ids=<function>) when the function returns non-strings. - Fix/improve collection of args when passing in __init__.py and a test file. - more_itertools is now constrained to <6.0.0 when required for Python 2.7 compatibility. - Fix "ValueError: Plugin already registered" exceptions when running in build directories that symlink to actual source. Improved Documentation - Add note to plugins.rst that pytest_plugins should not be used as a name for a user module containing plugins. - Document how to use raises and does_not_raise to write parametrized tests with conditional raises. - Document how to customize test failure messages when using pytest.warns. Trivial/Internal Changes - Some verbosity related attributes of the TerminalReporter plugin are now read only properties.
py-test: Remove not needed REPLACE_PYTHON (file no longer exists)
py-test: updated to 4.2.0 pytest 4.2.0: Features * Class xunit-style functions and methods now obey the scope of autouse fixtures. This fixes a number of surprising issues like setup_method being called before session-scoped autouse fixtures. * Display a message at the end of the test session when running under Python 2.7 and 3.4 that pytest 5.0 will no longer support those Python versions. * The number of selected tests now are also displayed when the -k or -m flags are used. * pytest_report_teststatus hook now can also receive a config parameter. * pytest_terminal_summary hook now can also receive a config parameter. Bug Fixes * --junitxml can emit XML compatible with Jenkins xUnit. junit_family INI option accepts legacy|xunit1, which produces old style output, and xunit2 that conforms more strictly to https://github.com/jenkinsci/xunit-plugin/blob/xunit-2.3.2/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd * Improve quitting from pdb, especially with --trace. Using q[quit] after pdb.set_trace() will quit pytest also. * Warning summary now groups warnings by message instead of by test id. This makes the output more compact and better conveys the general idea of how much code is actually generating warnings, instead of how many tests call that code. * monkeypatch.delattr handles class descriptors like staticmethod/classmethod. * Restore marks being considered keywords for keyword expressions. * tmp_path fixture and other related ones provides resolved path (a.k.a real path) * pytest_terminal_summary uses result from pytest_report_teststatus hook, rather than hardcoded strings. * Correctly handle unittest.SkipTest exception containing non-ascii characters on Python 2. * Ensure the tmpdir and the tmp_path fixtures are the same folder. * Ensure tmp_path is always a real path. Trivial/Internal Changes * Use a.item() instead of the deprecated np.asscalar(a) in pytest.approx. np.asscalar has been deprecated in numpy 1.16.. * Copy saferepr from pylib
py-test: updated to 4.1.1 pytest 4.1.1: Bug Fixes * Show full repr with assert a==b and -vv. * Extend Doctest-modules to ignore mock objects. * Fixed pytest.warns bug when context manager is reused (e.g. multiple parametrization). * Don’t rewrite assertion when __getattr__ is broken
py-test: updated to 4.1.0 pytest 4.1.0: Removals * 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. * Remove legacy internal warnings system: config.warn, Node.warn. The pytest_logwarning now issues a warning when implemented. See our docs on information on how to update your code. * Removed support for yield tests - they are fundamentally broken because they don’t support fixtures properly since collection and test execution were separated. See our docs on information on how to update your code. * Removed support for applying marks directly to values in @pytest.mark.parametrize. Use pytest.param instead. See our docs on information on how to update your code. * Removed Metafunc.addcall. This was the predecessor mechanism to @pytest.mark.parametrize. See our docs on information on how to update your code. * Removed support for passing strings to pytest.main. Now, always pass a list of strings instead. See our docs on information on how to update your code. * [pytest] section in setup.cfg files is not longer supported, use [tool:pytest] instead. setup.cfg files are meant for use with distutils, and a section named pytest has notoriously been a source of conflicts and bugs. Note that for pytest.ini and tox.ini files the section remains [pytest]. * Removed the deprecated compat properties for node.Class/Function/Module - use pytest.Class/Function/Module now. See our docs on information on how to update your code. * Removed the implementation of the pytest_namespace hook. See our docs on information on how to update your code. * Removed request.cached_setup. This was the predecessor mechanism to modern fixtures. See our docs on information on how to update your code. * Removed the deprecated PyCollector.makeitem method. This method was made public by mistake a long time ago. * Removed support to define fixtures using the pytest_funcarg__ prefix. Use the @pytest.fixture decorator instead. See our docs on information on how to update your code. * Calling fixtures directly is now always an error instead of a warning. See our docs on information on how to update your code. * Remove Node.get_marker(name) the return value was not usable for more than a existence check. Use Node.get_closest_marker(name) as a replacement. * The deprecated record_xml_property fixture has been removed, use the more generic record_property instead. See our docs for more information. * 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). See our docs for more information. * Remove testfunction.markername attributes - use Node.iter_markers(name=None) to iterate them. Deprecations * Deprecated the pytest.config global. See https://docs.pytest.org/en/latest/deprecations.html#pytest-config-global for rationale. * Passing the message parameter of pytest.raises now issues a DeprecationWarning. It is a common mistake to think this parameter will match the exception message, while in fact it only serves to provide a custom message in case the pytest.raises check fails. To avoid this mistake and because it is believed to be little used, pytest is deprecating it without providing an alternative for the moment. If you have concerns about this, please comment on issue 3974. * Deprecated raises(..., 'code(as_a_string)') and warns(..., 'code(as_a_string)'). See https://docs.pytest.org/en/latest/deprecations.html#raises-warns-exec for rationale and examples. Features * A warning is now issued when assertions are made for None. This is a common source of confusion among new users, which write: assert mocked_object.assert_called_with(3, 4, 5, key="value") When they should write: mocked_object.assert_called_with(3, 4, 5, key="value") Because the assert_called_with method of mock objects already executes an assertion. This warning will not be issued when None is explicitly checked. An assertion like: assert variable is None will not issue the warning. * Richer equality comparison introspection on AssertionError for objects created using attrs or dataclasses (Python 3.7+, backported to 3.6). * CACHEDIR.TAG files are now created inside cache directories. Those files are part of the Cache Directory Tagging Standard, and can be used by backup or synchronization programs to identify pytest’s cache directory as such. * pytest.outcomes.Exit is derived from SystemExit instead of KeyboardInterrupt. This allows us to better handle pdb exiting. * Updated the --collect-only option to display test descriptions when ran using --verbose. * Restructured ExceptionInfo object construction and ensure incomplete instances have a repr/str. * pdb: added support for keyword arguments with pdb.set_trace. It handles header similar to Python 3.7 does it, and forwards any other keyword arguments to the Pdb constructor. This allows for __import__("pdb").set_trace(skip=["foo.*"]). * Added ini parameter junit_duration_report to optionally report test call durations, excluding setup and teardown times. The JUnit XML specification and the default pytest behavior is to include setup and teardown times in the test duration report. You can include just the call durations instead (excluding setup and teardown) by adding this to your pytest.ini file: [pytest] junit_duration_report = call * -ra now will show errors and failures last, instead of as the first items in the summary. This makes it easier to obtain a list of errors and failures to run tests selectively. * pytest.importorskip now supports a reason parameter, which will be shown when the requested module cannot be imported. Bug Fixes * -p now accepts its argument without a space between the value, for example -pmyplugin. * approx again works with more generic containers, more precisely instances of Iterable and Sized instead of more restrictive Sequence. * Ensure that node ids are printable. * Fixed raises(..., 'code(string)') frame filename. * Display actual test ids in --collect-only. Improved Documentation * Markers example documentation page updated to support latest pytest version. * Update cache documentation example to correctly show cache hit and miss. * Improved detailed summary report documentation. Trivial/Internal Changes * Changed the deprecation type of --result-log to PytestDeprecationWarning.
py-test: updated to 4.0.2 pytest 4.0.2: Bug Fixes - Validate arguments from the PYTEST_ADDOPTS environment variable and the addopts ini option separately. - Fix raises(..., 'code(string)') frame filename. - When a fixture yields and a log call is made after the test runs, and, if the test is interrupted, capture attributes are None. - Raise TypeError for with raises(..., match=<non-None falsey value>).
py-test: pathlib2 is needed by py27-test too Due the if-elif condition pathlib2 was accidentally not marked as dependency in the py27 case.
py-test: updated to 4.0.1 pytest 4.0.1: Bug Fixes - Display warnings before "short test summary info" again, but still later warnings in the end. - Handle uninitialized exceptioninfo in repr/str. - Do not create .gitignore/README.md files in existing cache directories. - Rearrange warning handling for the yield test errors so the opt-out in 4.0.x correctly works. - Fix collection of testpaths with --pyargs. - Fix assertion rewriting involving Starred + side-effects. - Ensure we resolve the absolute path when the given --basetemp is a relative path. - Use pkg_resources.parse_version instead of LooseVersion in minversion check. - Adjust the stack level of some internal pytest warnings.
py-test: updated to 3.10.1 pytest 3.10.1: Bug Fixes - Fix nested usage of debugging plugin (pdb), e.g. with pytester's testdir.runpytest. - Block the stepwise plugin if cacheprovider is also blocked, as one depends on the other. - Parse minversion as an actual version and not as dot-separated strings. - Fix duplicate collection due to multiple args matching the same packages. - Fix item.nodeid with resolved symlinks. - Fix collection of direct symlinked files, where the target does not match python_files. - Fix TypeError in report_collect with _collect_report_last_write. Trivial/Internal Changes - Replace byte/unicode helpers in test_capture with python level syntax.
py-test: updated to 3.10.0 pytest 3.10.0: Features * Resume capturing output after continue with __import__("pdb").set_trace(). This also adds a new pytest_leave_pdb hook, and passes in pdb to the existing pytest_enter_pdb hook. * 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 for more info. * 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. * Improve performance with collection reporting in non-quiet mode with terminals. The “collecting …” message is only printed/updated every 0.5s. Bug Fixes * Fix false RemovedInPytest4Warning: usage of Session... is deprecated, please use pytest warnings. * Fix problems with running tests in package __init__.py files. * Swallow warnings during anonymous compilation of source. * Fix access denied error when deleting stale directories created by tmpdir / tmp_path. * Naming a fixture request will now raise a warning: the request fixture is internal and should not be overwritten as it will lead to internal errors. * Handle (ignore) exceptions raised during collection, e.g. with Django’s LazySettings proxy class. Improved Documentation * Added missing documentation about the fact that module names passed to filter warnings are not regex-escaped. Trivial/Internal Changes * Display cachedir also in non-verbose mode if non-default. * pdb: improve message about output capturing with set_trace. Do not display “IO-capturing turned off/on” when -s is used to avoid confusion. * Improve message and stack level of warnings issued by monkeypatch.setenv when the value of the environment variable is not a str.
py-test: updated to 3.9.3 pytest 3.9.3: Bug Fixes * Fix “ValueError: Plugin already registered” with conftest plugins via symlink. * Handle race condition between creation and deletion of temporary folders. * Fix bug where the warning summary at the end of the test session was not showing the test where the warning was originated. * Fix regression when stacklevel for warnings was passed as positional argument on python2. Improved Documentation * Add reference to empty_parameter_set_mark ini option in documentation of @pytest.mark.parametrize Trivial/Internal Changes * Revert patching of sys.breakpointhook since it appears to do nothing. * Apply an import sorter (reorder-python-imports) to the codebase. * Remove use of unnecessary compat shim, six.binary_type
py-test: updated to 3.9.2 pytest 3.9.2: Bug Fixes * Improve error message when a recursive dependency between fixtures is detected. * Fix logging messages not shown in hooks pytest_sessionstart() and pytest_sessionfinish(). * Fix unescaped XML raw objects in JUnit report for skipped tests * Python 2: safely format warning message about passing unicode strings to warnings.warn, which may cause surprising MemoryError exception when monkey patching warnings.warn itself. * Improve error message when it is not possible to determine a function’s signature. * Pin setuptools>=40.0 to support py_modules in setup.cfg * Restore the tmpdir behaviour of symlinking the current test run. * Fix filename reported by warnings.warn when using recwarn under python2.
py-test: updated to 3.9.1 pytest 3.9.1: Features - For test-suites containing test classes, the information about the subclassed module is now output only if a higher verbosity level is specified (at least “-vv”). pytest 3.9.0: Deprecations - The following accesses have been documented as deprecated for years, but are now actually emitting deprecation warnings. Access of Module, Function, Class, Instance, File and Item through Node instances. Now users will this warning: usage of Function.Module is deprecated, please use pytest.Module instead Users should just import pytest and access those objects using the pytest module. request.cached_setup, this was the precursor of the setup/teardown mechanism available to fixtures. You can consult funcarg comparison section in the docs. Using objects named "Class" as a way to customize the type of nodes that are collected in Collector subclasses has been deprecated. Users instead should use pytest_collect_make_item to customize node types during collection. This issue should affect only advanced plugins who create new collection types, so if you see this warning message please contact the authors so they can change the code. The warning that produces the message below has changed to RemovedInPytest4Warning: getfuncargvalue is deprecated, use getfixturevalue - Add a Deprecation warning for pytest.ensuretemp as it was deprecated since a while. Features - Improve usage errors messages by hiding internal details which can be distracting and noisy. This has the side effect that some error conditions that previously raised generic errors (such as ValueError for unregistered marks) are now raising Failed exceptions. - Improve the error displayed when a conftest.py file could not be imported. In order to implement this, a new chain parameter was added to ExceptionInfo.getrepr to show or hide chained tracebacks in Python 3 (defaults to True). - Add empty_parameter_set_mark=fail_at_collect ini option for raising an exception when parametrize collects an empty set. - Log messages generated in the collection phase are shown when live-logging is enabled and/or when they are logged to a file. - Introduce tmp_path as a fixture providing a Path object. - Deprecation warnings are now shown even if you customize the warnings filters yourself. In the previous version any customization would override pytest’s filters and deprecation warnings would fall back to being hidden by default. - Allow specification of timeout for Testdir.runpytest_subprocess() and Testdir.run(). - Add returncode argument to pytest.exit() to exit pytest with a specific return code. - Reimplement pytest.deprecated_call using pytest.warns so it supports the match='...' keyword argument. This has the side effect that pytest.deprecated_call now raises pytest.fail.Exception instead of AssertionError. - Require setuptools>=30.3 and move most of the metadata to setup.cfg. Bug Fixes - Improve error message when test functions of unittest.TestCase subclasses use a parametrized fixture. - request.fixturenames now correctly returns the name of fixtures created by request.getfixturevalue(). - Warning filters passed as command line options using -W now take precedence over filters defined in ini configuration files. - Fix source reindenting by using textwrap.dedent directly. - pytest.warn will capture previously-warned warnings in Python 2. Previously they were never raised. - Resolve symbolic links for args. This fixes running pytest tests/test_foo.py::test_bar, where tests is a symlink to project/app/tests: previously project/app/conftest.py would be ignored for fixtures then. - Fix duplicate printing of internal errors when using --pdb. - pathlib based tmpdir cleanup now correctly handles symlinks in the folder. - Display the filename when encountering SyntaxWarning. Improved Documentation - Update usefixtures documentation to clarify that it can’t be used with fixture functions. - Update fixture documentation to specify that a fixture can be invoked twice in the scope it’s defined for. - According to unittest.rst, setUpModule and tearDownModule were not implemented, but it turns out they are. So updated the documentation for unittest. - Add tempir testing example to CONTRIBUTING.rst guide Trivial/Internal Changes - The internal MarkerError exception has been removed. - Port the implementation of tmpdir to pathlib. - Exclude 0.00 second entries from --duration output unless -vv is passed on the command-line. - Fixed formatting of string literals in internal tests.
py-test: updated to 3.8.2 pytest 3.8.2: Deprecations and Removals * The item parameter of pytest_warning_captured hook is now documented as deprecated. We realized only after the 3.8 release that this parameter is incompatible with pytest-xdist. Our policy is to not deprecate features during bugfix releases, but in this case we believe it makes sense as we are only documenting it as deprecated, without issuing warnings which might potentially break test suites. This will get the word out that hook implementers should not use this parameter at all. In a future release item will always be None and will emit a proper warning when a hook implementation makes use of it. Bug Fixes * Fix reload on assertion rewritten modules. * The .user_properties attribute of TestReport objects is a list of (name, value) tuples, but could sometimes be instantiated as a tuple of tuples. It is now always a list. * No longer issue warnings about using pytest_plugins in non-top-level directories when using --pyargs: the current --pyargs mechanism is not reliable and might give false negatives. * Exclude empty reports for passed tests when -rP option is used. * Improve error message when an invalid Python expression is passed to the -m option. * MonkeyPatch.setenv and MonkeyPatch.delenv issue a warning if the environment variable name is not str on Python 2. In Python 2, adding unicode keys to os.environ causes problems with subprocess (and possible other modules), making this a subtle bug specially susceptible when used with from __future__ import unicode_literals. Improved Documentation * Add possible values for fixture scope to docs.
py-test: updated to 3.8.1 pytest 3.8.1: Bug Fixes * .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. * Fix the following error during collection of tests inside packages: TypeError: object of type 'Package' has no len() * 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. * Fix crash of the assertion rewriter if a test changed the current working directory without restoring it afterwards. * Fix issue that prevented some caplog properties (for example record_tuples) from being available when entering the debugger with --pdb. * Fix UnicodeDecodeError in python2.x when a class returns a non-ascii binary __repr__ in an assertion which also contains non-ascii text. Improved Documentation * New Deprecations and Removals page shows all currently deprecated features, the rationale to do so, and alternatives to update your code. It also list features removed from pytest in past major releases to help those with ancient pytest versions to upgrade. Trivial/Internal Changes * Improve pre-commit detection for changelog filenames * Remove legacy code around im_func as that was python2 only
py-test: updated to 3.8.0 pytest 3.8.0: Deprecations and Removals - Config.warn has been deprecated, it should be replaced by calls to the standard warnings.warn. Node.warn now supports two signatures: * node.warn(PytestWarning("some message")): is now the recommended way to call this function. The warning instance must be a PytestWarning or subclass instance. * node.warn("CI", "some message"): this code/message form is now deprecated and should be converted to the warning instance form above. RemovedInPytest4Warning and PytestExperimentalApiWarning are now part of the public API and should be accessed using pytest.RemovedInPytest4Warning and pytest.PytestExperimentalApiWarning. - @pytest.mark.filterwarnings second parameter is no longer regex-escaped, making it possible to actually use regular expressions to check the warning message. **Note**: regex-escaping the match string was an implementation oversight that might break test suites which depend on the old behavior. Features - Internal pytest warnings are now issued using the standard warnings module, making it possible to use the standard warnings filters to manage those warnings. This introduces PytestWarning, PytestDeprecationWarning and RemovedInPytest4Warning warning types as part of the public API. - DeprecationWarning and PendingDeprecationWarning are now shown by default if no other warning filter is configured. - Add option to disable plugin auto-loading. - Added the count option to console_output_style to enable displaying the progress as a count instead of a percentage. - Added support for 'xfailed' and 'xpassed' outcomes to the pytester.RunResult.assert_outcomes signature. - Terminal writer now takes into account unicode character width when writing out progress. - Pytest now returns with correct exit code (EXIT_USAGEERROR, 4) when called with unknown arguments. - Improve performance of assertion rewriting. - Added a blurb in usage.rst for the usage of -r flag which is used to show an extra test summary info. - Corrected type of the exceptions collection passed to xfail: raises argument accepts a tuple instead of list. Trivial/Internal Changes - Removed "run all (no recorded failures)" message printed with --failed-first and --last-failed when there are no failed tests.
py-test: updated to 3.7.4 pytest 3.7.4: Bug Fixes - Fix possible infinite recursion when writing .pyc files. - Cache plugin now obeys the -q flag when --last-failed and --failed-first flags are used. - Fix bad console output when using console_output_style=classic. - Fix macOS specific code using capturemanager plugin in doctests.
py-test: DEPEND on py-pathlib2 for Python < 3.6
py-test: updated to 3.7.3 pytest 3.7.3: Bug Fixes * Fixtures during teardown can again use capsys and capfd to inspect output captured during tests. * Fix collection of tests from __init__.py files if they match the python_files configuration option. * Fix issue where teardown of fixtures of consecutive sub-packages were executed once, at the end of the outer package. * Fix bug where --show-capture=no option would still show logs printed during fixture teardown. * Fix stdout/stderr not getting captured when real-time cli logging is active. * Fix collection error when specifying test functions directly in the command line using test.py::test syntax together with --doctest-modules. * Fix bugs where unicode arguments could not be passed to testdir.runpytest on Python 2. * Fix double collection of tests within packages when the filename starts with a capital letter.
py-test: updated to 3.7.2 pytest 3.7.2: Bug Fixes - Fix filterwarnings not being registered as a builtin mark. - Fix test collection from packages mixed with normal directories. - Fix infinite recursion during collection if a pytest_ignore_collect hook returns False instead of None. - Fix bug where decorated fixtures would lose functionality (for example @mock.patch). - Fix bug where importing modules or other objects with prefix pytest_ prefix would raise a PluginValidationError. - Fix AttributeError during teardown of TestCase subclasses which raise an exception during __init__. - Fix traceback reporting for exceptions with __cause__ cycles.
py-test: bump py-pluggy DEPENDS
py-test: updated to 3.7.1 pytest 3.7.1: Bug Fixes - Raise immediately if approx() is given an expected value of a type it doesn't understand (e.g. strings, nested dicts, etc.). - Correctly represent the dimensions of an numpy array when calling repr() on approx(). - Display the absolute path if cache_dir is not relative to the rootdir instead of failing. - Fix compatibility problem with plugins and the warning code issued by fixture functions when they are called directly. - Fix infinite recursion in pytest.approx with arrays in numpy<1.13. - Pin pathlib2 to >=2.2.0 as we require __fspath__ support. - Fix TypeError when the assertion message is bytes in python 3. pytest 3.7.0: Deprecations and Removals - pytest_namespace has been deprecated. See the documentation for pytest_namespace hook for suggestions on how to deal with this in plugins which use this functionality. - Calling a fixture function directly, as opposed to request them in a test function, now issues a RemovedInPytest4Warning. It will be changed into an error in pytest 4.0. This is a great source of confusion to new users, which will often call the fixture functions and request them from test functions interchangeably, which breaks the fixture resolution model. Features - New package fixture scope: fixtures are finalized when the last test of a *package* finishes. This feature is considered **experimental**, so use it sparingly. - Node.add_marker now supports an append=True/False parameter to determine whether the mark comes last (default) or first. - 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. - New --trace option to enter the debugger at the start of a test. - Introduce pytester.copy_example as helper to do acceptance tests against examples from the project. Bug Fixes - 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. - Fix ApproxNumpy initialisation argument mixup, abs and rel tolerances were flipped causing strange comparsion results. Add tests to check abs and rel tolerances for np.array and test for expecting nan with np.array() - Fix truncated locals output in verbose mode. Improved Documentation - 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. Trivial/Internal Changes - Now a README.md file is created in .pytest_cache to make it clear why the directory exists.
py-test: updated to 3.6.3 3.6.3: Bug Fixes * Fix ImportWarning triggered by explicit relative imports in assertion-rewritten package modules. * Fix error in pytest.approx when dealing with 0-dimension numpy arrays. * No longer raise ValueError when using the get_marker API. * Fix problem where log messages with non-ascii characters would not appear in the output log file. * No longer raise AttributeError when legacy marks can’t be stored in functions. Improved Documentation * The description above the example for @pytest.mark.skipif now better matches the code. Trivial/Internal Changes * Internal refactoring: removed unused CallSpec2tox ._globalid_args attribute and metafunc parameter from CallSpec2.copy(). * Silence usage of reduce warning in Python 2 * Fix usage of attr.ib deprecated convert parameter
py-test: updated to 3.6.2 Pytest 3.6.2: Bug Fixes Fix regression in Node.add_marker by extracting the mark object of a MarkDecorator. Warnings without location were reported as None. This is corrected to now report <undetermined location>. Continue to call finalizers in the stack when a finalizer in a former scope raises an exception. Fix encoding error with print statements in doctests Improved Documentation Add documentation for the --strict flag. Trivial/Internal Changes Update old quotation style to parens in fixture.rst documentation. Improve display of hint about --fulltrace with KeyboardInterrupt. pytest’s testsuite is no longer runnable through python setup.py test – instead invoke pytest or tox directly. Fix typo in documentation
py-test: updated to 3.6.1 Pytest 3.6.1: Bug Fixes * Fixed a bug where stdout and stderr were logged twice by junitxml when a test was marked xfail. * Fix usefixtures mark applyed to unittest tests by correctly instantiating FixtureInfo. * Fix assertion rewriter compatibility with libraries that monkey patch file objects. Improved Documentation * Added a section on how to use fixtures as factories to the fixture documentation. Trivial/Internal Changes * Enable caching for pip/pre-commit in order to reduce build time on travis/appveyor. * Switch pytest to the src/ layout as we already suggested it for good practice - now we implement it as well. * Fix if in tests to support 3.7.0b5, where a docstring handling in AST got reverted. * Remove some python2.5 compatibility code.
py-test: updated to 3.6.0 Pytest 3.6.0 Features Revamp the internals of the pytest.mark implementation with correct per node handling which fixes a number of long standing bugs caused by the old design. This introduces new Node.iter_markers(name) and Node.get_closest_mark(name) APIs. Users are strongly encouraged to read the reasons for the revamp in the docs, or jump over to details about updating existing code to use the new APIs. Now when @pytest.fixture is applied more than once to the same function a ValueError is raised. This buggy behavior would cause surprising problems and if was working for a test suite it was mostly by accident. Support for Python 3.7’s builtin breakpoint() method, see Using the builtin breakpoint function for details. monkeypatch now supports a context() function which acts as a context manager which undoes all patching done within the with block. The --pdb option now causes KeyboardInterrupt to enter the debugger, instead of stopping the test session. On python 2.7, hitting CTRL+C again exits the debugger. On python 3.2 and higher, use CTRL+D. pytest not longer changes the log level of the root logger when the log-level parameter has greater numeric value than that of the level of the root logger, which makes it play better with custom logging configuration in user code. Bug Fixes A rare race-condition which might result in corrupted .pyc files on Windows has been hopefully solved. Also use iter_marker for discovering the marks applying for marker expressions from the cli to avoid the bad data from the legacy mark storage. When showing diffs of failed assertions where the contents contain only whitespace, escape them using repr() first to make it easy to spot the differences.
py-test: updated to 3.5.1 Pytest 3.5.1: Bug Fixes Reset sys.last_type, sys.last_value and sys.last_traceback before each test executes. Those attributes are added by pytest during the test run to aid debugging, but were never reset so they would create a leaking reference to the last failing test’s frame which in turn could never be reclaimed by the garbage collector. pytest.raises now raises TypeError when receiving an unknown keyword argument. pytest.raises now works with exception classes that look like iterables. Improved Documentation Fix typo in caplog fixture documentation, which incorrectly identified certain attributes as methods. Trivial/Internal Changes Added a more indicative error message when parametrizing a function whose argument takes a default value. Remove internal _pytest.terminal.flatten function in favor of more_itertools.collapse. Import some modules from collections.abc instead of collections as the former modules trigger DeprecationWarning in Python 3.7. record_property is no longer experimental, removing the warnings was forgotten. Mention in documentation and CLI help that fixtures with leading _ are printed by pytest --fixtures only if the -v option is added.
py-test: updated to 3.5.0 3.5.0: Deprecations and Removals record_xml_property fixture is now deprecated in favor of the more generic record_property. Defining pytest_plugins is now deprecated in non-top-level conftest.py files, because they “leak” to the entire directory tree. Features New --show-capture command-line option that allows to specify how to display captured output when tests fail: no, stdout, stderr, log or all New --rootdir command-line option to override the rules for discovering the root directory. See customize in the documentation for details. Fixtures are now instantiated based on their scopes, with higher-scoped fixtures record_xml_property renamed to record_property and is now compatible with xdist, markers and any reporter. record_xml_property name is now deprecated. New --nf, --new-first options: run new tests first followed by the rest of the tests, in both cases tests are also sorted by the file modified time, with more recent files coming first. New --last-failed-no-failures command-line option that allows to specify the behavior of the cache plugin’s `--last-failed feature when no tests failed in the last run New --doctest-continue-on-failure command-line option to enable doctests to show multiple failures for each snippet, instead of stopping at the first failure. Captured log messages are added to the <system-out> tag in the generated junit xml file if the junit_logging ini option is set to system-out. If the value of this ini option is system-err`, the logs are written to ``<system-err>. The default value for junit_logging is no, meaning captured logs are not written to the output file. Allow the logging plugin to handle pytest_runtest_logstart and pytest_runtest_logfinish hooks when live logs are enabled. Passing –log-cli-level in the command-line now automatically activates live logging. Add command line option --deselect to allow deselection of individual tests at collection time. Captured logs are printed before entering pdb. Deselected item count is now shown before tests are run, e.g. collected X items / Y deselected. The builtin module platform is now available for use in expressions in pytest.mark. The short test summary info section now is displayed after tracebacks and warnings in the terminal. New --verbosity flag to set verbosity level explicitly. pytest.approx now accepts comparing a numpy array with a scalar. Bug Fixes Suppress IOError when closing the temporary file used for capturing streams in Python 2.7. Fixed clear() method on caplog fixture which cleared records, but not the text property. During test collection, when stdin is not allowed to be read, the DontReadFromStdin object still allow itself to be iterable and resolved to an iterator without crashing. Improved Documentation Added a reference page to the docs. Trivial/Internal Changes Change minimum requirement of attrs to 17.4.0. Renamed example directories so all tests pass when ran from the base directory. Internal mark.py module has been turned into a package. pytest now depends on the more_itertools package. Added warning when [pytest] section is used in a .cfg file passed with -c nodeids can now be passed explicitly to FSCollector and Node constructors. Internal refactoring of FormattedExcinfo to use attrs facilities and remove old support code for legacy Python versions. Refactoring to unify how verbosity is handled internally. Internal refactoring to better integrate with argparse. Fix a python example when calling a fixture in doc/en/usage.rst
py-test: updated to 3.4.2 Pytest 3.4.2: Bug Fixes Removed progress information when capture option is no. Refactor check of bindir from exists to isdir. Fix TypeError issue when using approx with a Decimal value. Fix reference cycle generated when using the request fixture. [tool:pytest] sections in *.cfg files passed by the -c option are now properly recognized. Improved Documentation Add logging plugin to plugins list. Trivial/Internal Changes Fix minor typo in fixture.rst
py-test: updated to 3.4.1 Pytest 3.4.1 Bug Fixes Move import of doctest.UnexpectedException to top-level to avoid possible errors when using --pdb. Added printing of captured stdout/stderr before entering pdb, and improved a test which was giving false negatives about output capturing. Fix ordering of tests using parametrized fixtures which can lead to fixtures being created more than necessary. Fix bug where logging happening at hooks outside of "test run" hooks would cause an internal error. Detect arguments injected by unittest.mock.patch decorator correctly when pypi mock.patch is installed and imported. Errors shown when a pytest.raises() with match= fails are now cleaner on what happened: When no exception was raised, the "matching '...'" part got removed as it falsely implies that an exception was raised but it didn't match. When a wrong exception was raised, it's now thrown Fixed output capture handling in doctests on macOS. Improved Documentation Add Sphinx parameter docs for match and message args to pytest.raises. Trivial/Internal Changes pytest has changed the publication procedure and is now being published to PyPI directly from Travis. Rename ParameterSet._for_parameterize() to _for_parametrize() in order to comply with the naming convention. Skip failing pdb/doctest test on mac.
py-test: updated to 3.4.0 Pytest 3.4.0 Deprecations and Removals - All pytest classes now subclass object for better Python 2/3 compatibility. This should not affect user code except in very rare edge cases. Features - Introduce empty_parameter_set_mark ini option to select which mark to apply when @pytest.mark.parametrize is given an empty set of parameters. Valid options are skip (default) and xfail. Note that it is planned to change the default to xfail in future releases as this is considered less error prone. - **Incompatible change**: after community feedback the logging <https://docs.pytest.org/en/latest/logging.html>_ functionality has undergone some changes. Please consult the logging documentation <https://docs.pytest.org/en/latest/logging.html#incompatible-changes-in-pytest-3-4>_ for details. - Console output falls back to "classic" mode when capturing is disabled (-s), otherwise the output gets garbled to the point of being useless. - New pytest_runtest_logfinish <https://docs.pytest.org/en/latest/writing_plugins.html#_pytest.hookspec.pytest_runtest_logfinish>_ hook which is called when a test item has finished executing, analogous to pytest_runtest_logstart <https://docs.pytest.org/en/latest/writing_plugins.html#_pytest.hookspec.pytest_runtest_start>_. - Improve performance when collecting tests using many fixtures. - New caplog.get_records(when) method which provides access to the captured records for the "setup", "call" and "teardown" testing stages. - New fixture record_xml_attribute that allows modifying and inserting attributes on the <testcase> xml node in JUnit reports. - The default cache directory has been renamed from .cache to .pytest_cache after community feedback that the name .cache did not make it clear that it was used by pytest. - Colorize the levelname column in the live-log output. Bug Fixes - Fix hanging pexpect test on MacOS by using flush() instead of wait(). - Fix restoring Python state after in-process pytest runs with the pytester plugin; this may break tests using multiple inprocess pytest runs if later ones depend on earlier ones leaking global interpreter changes. - Fix skipping plugin reporting hook when test aborted before plugin setup hook. - Fix progress percentage reported when tests fail during teardown. - **Incompatible change**: -o/--override option no longer eats all the remaining options, which can lead to surprising behavior: for example, pytest -o foo=1 /path/to/test.py would fail because /path/to/test.py would be considered as part of the -o command-line argument. One consequence of this is that now multiple configuration overrides need multiple -o flags: pytest -o foo=1 -o bar=2.
py-test: updated to 3.3.2 Pytest 3.3.2: Bug Fixes - pytester: ignore files used to obtain current user metadata in the fd leak detector. - Fix **memory leak** where objects returned by fixtures were never destructed by the garbage collector. - Fix conversion of pyargs to filename to not convert symlinks and not use deprecated features on Python 3. - PYTEST_DONT_REWRITE is now checked for plugins too rather than only for test modules. Improved Documentation - Add clarifying note about behavior of multiple parametrized arguments Trivial/Internal Changes - Code cleanup. - Clean up code by replacing imports and references of _ast to ast.
py-test: updated to 3.3.1 Pytest 3.3.1: Bug Fixes * Fix issue about -p no:<plugin> having no effect. * Fix regression with warnings that contained non-strings in their arguments in Python 2. * Always escape null bytes when setting PYTEST_CURRENT_TEST. * Fix ZeroDivisionError when using the testmon plugin when no tests were actually collected. * Bring back TerminalReporter.writer as an alias to TerminalReporter._tw. This alias was removed by accident in the 3.3.0 release. * The pytest-capturelog plugin is now also blacklisted, avoiding errors when running pytest with it still installed. Improved Documentation * Fix broken link to plugin pytest-localserver.
py-test: updated to 3.3.0 Pytest 3.3.0: Deprecations and Removals ------------------------- Pytest no longer supports Python 2.6 and 3.3. Those Python versions are EOL for some time now and incur maintenance and compatibility costs on the pytest core team, and following up with the rest of the community we decided that they will no longer be supported starting on this version. Users which still require those versions should pin pytest to <3.3. Remove internal _preloadplugins() function. This removal is part of the pytest_namespace() hook deprecation. Internally change CallSpec2 to have a list of marks instead of a broken mapping of keywords. This removes the keywords attribute of the internal CallSpec2 class. Remove ParameterSet.deprecated_arg_dict - its not a public api and the lack of the underscore was a naming error. Remove the internal multi-typed attribute Node._evalskip and replace it with the boolean Node._skipped_by_mark. Features -------- pytest_fixture_post_finalizer hook can now receive a request argument. Replace the old introspection code in compat.py that determines the available arguments of fixtures with inspect.signature on Python 3 and funcsigs.signature on Python 2. This should respect __signature__ declarations on functions. Report tests with global pytestmark variable only once. Now pytest displays the total progress percentage while running tests. The previous output style can be set by configuring the console_output_style setting to classic. Match warns signature to raises by adding match keyword. Pytest now captures and displays output from the standard logging module. The user can control the logging level to be captured by specifying options in pytest.ini, the command line and also during individual tests using markers. Also, a caplog fixture is available that enables users to test the captured log during specific tests (similar to capsys for example). For more information, please see the logging docs. This feature was introduced by merging the popular pytest-catchlog plugin, thanks to Thomas Hisch. Be advised that during the merging the backward compatibility interface with the defunct pytest-capturelog has been dropped. Add allow_module_level kwarg to pytest.skip(), enabling to skip the whole module. Allow setting file_or_dir, -c, and -o in PYTEST_ADDOPTS. Return stdout/stderr capture results as a namedtuple, so out and ``err`` can be accessed by attribute. Add capfdbinary, a version of capfd which returns bytes from readouterr(). Add capsysbinary a version of capsys which returns bytes from readouterr(). Implement feature to skip setup.py files when run with --doctest-modules.
py-test: updated to 3.2.5 Pytest 3.2.5: Bug Fixes Remove py<1.5 restriction from pytest as this can cause version conflicts in some installations.
py-test: updated to 3.2.4 Pytest 3.2.4: Bug Fixes * Fix the bug where running with --pyargs will result in items with empty parent.nodeid if run from a different root directory. * Fix issue with @pytest.parametrize if argnames was specified as keyword arguments. * Strip whitespace from marker names when reading them from INI config. * Show full context of doctest source in the pytest output, if the line number of failed example in the docstring is < 9
py-test: update to 3.2.3 Pytest 3.2.3 Bug Fixes * Fix crash in tab completion when no prefix is given. * The equality checking function (__eq__) of MarkDecorator returns False if one object is not an instance of MarkDecorator. * When running pytest --fixtures-per-test: don’t crash if an item has no _fixtureinfo attribute (e.g. doctests) Improved Documentation * In help text of -k option, add example of using not to not select certain tests whose names match the provided expression. * Add note in parametrize.rst about calling metafunc.parametrize multiple times. Trivial/Internal Changes * Set xfail_strict=True in pytest’s own test suite to catch expected failures as soon as they start to pass. * Fix typo in example of passing a callable to markers (in example/markers.rst)
Pytest 3.2.2: Bug Fixes * Calling the deprecated request.getfuncargvalue() now shows the source of the call. * Allow tests declared as @staticmethod to use fixtures. * Fixed edge-case during collection: attributes which raised pytest.fail when accessed would abort the entire collection. * Fix ReprFuncArgs with mixed unicode and UTF-8 args. Improved Documentation * In examples on working with custom markers, add examples demonstrating the usage of pytest.mark.MARKER_NAME.with_args in comparison with pytest.mark.MARKER_NAME.__call__ * In one of the simple examples, use pytest_collection_modifyitems() to skip tests based on a command-line option, allowing its sharing while preventing a user error when acessing pytest.config before the argument parsing. Trivial/Internal Changes * Fixed minor error in ‘Good Practices/Manual Integration’ code snippet. * Fixed typo in goodpractices.rst. * Improve user guidance regarding --resultlog deprecation.
Pytest 3.2.1 Bug Fixes: * Fixed small terminal glitch when collecting a single test item. * Correctly consider / as the file separator to automatically mark plugin files for rewrite on Windows. * Properly escape test names when setting PYTEST_CURRENT_TEST environment variable. * Fix error on Windows and Python 3.6+ when sys.stdout has been replaced with a stream-like object which does not implement the full io module buffer protocol. In particular this affects pytest-xdist users on the aforementioned platform. Improved Documentation * Explicitly document which pytest features work with unittest.
Pytest 3.2.0: Deprecations and Removals pytest.approx no longer supports >, >=, < and <= operators to avoid surprising/inconsistent behavior. See the docs for more information. All old-style specific behavior in current classes in the pytest’s API is considered deprecated at this point and will be removed in a future release. This affects Python 2 users only and in rare situations. A deprecation warning is now raised when using marks for parameters in pytest.mark.parametrize. Use pytest.param to apply marks to parameters instead. Features Add support for numpy arrays (and dicts) to approx. Now test function objects have a pytestmark attribute containing a list of marks applied directly to the test function, as opposed to marks inherited from parent classes or modules. Collection ignores local virtualenvs by default; –collect-in-virtualenv overrides this behavior. Allow class methods decorated as @staticmethod to be candidates for collection as a test function. (Only for Python 2.7 and above. Python 2.6 will still ignore static methods.) Introduce mark.with_args in order to allow passing functions/classes as sole argument to marks. New cache_dir ini option: sets the directory where the contents of the cache plugin are stored. Directory may be relative or absolute path: if relative path, then directory is created relative to rootdir, otherwise it is used as is. Additionally path may contain environment variables which are expanded during runtime. Introduce the PYTEST_CURRENT_TEST environment variable that is set with the nodeid and stage (setup, call and teardown) of the test being currently executed. See the documentation for more info. Introduced @pytest.mark.filterwarnings mark which allows overwriting the warnings filter on a per test, class or module level. See the docs for more information. --last-failed now remembers forever when a test has failed and only forgets it if it passes again. This makes it easy to fix a test suite by selectively running files and fixing tests incrementally. New pytest_report_collectionfinish hook which allows plugins to add messages to the terminal reporting after collection has been finished successfully. Added support for PEP-415’s Exception.__suppress_context__. Now if a raise exception from None is caught by pytest, pytest will no longer chain the context in the test report. The behavior now matches Python’s traceback behavior. Exceptions raised by pytest.fail, pytest.skip and pytest.xfail now subclass BaseException, making them harder to be caught unintentionally by normal code. Bug Fixes Set stdin to a closed PIPE in pytester.py.Testdir.popen() for avoid unwanted interactive pdb Add missing encoding attribute to sys.std* streams when using capsys capture mode. Fix terminal color changing to black on Windows if colorama is imported in a conftest.py file. Fix line number when reporting summary of skipped tests. capture: ensure that EncodedFile.name is a string. The options --fixtures and --fixtures-per-test will now keep indentation within docstrings. doctests line numbers are now reported correctly, fixing pytest-sugar. Fix non-determinism in order of fixture collection. Adds new dependency (ordereddict) for Python 2.6.
Pytest 3.1.3: Bug Fixes * Fix decode error in Python 2 for doctests in docstrings. * Exceptions raised during teardown by finalizers are now suppressed until all finalizers are called, with the initial exception reraised. * Fix incorrect “collected items” report when specifying tests on the command- line. deprecated_call in context-manager form now captures deprecation warnings even if the same warning has already been raised. Also, deprecated_call will always produce the same error message (previously it would produce different messages in context-manager vs. function-call mode). * Fix issue where paths collected by pytest could have triple leading / characters. * Fix internal error when trying to detect the start of a recursive traceback. Improved Documentation * Explicitly state for which hooks the calls stop after the first non-None result. Trivial/Internal Changes * Create invoke tasks for updating the vendored packages. * Update copyright dates in LICENSE, README.rst and in the documentation.
Pytest 3.1.2 (2017-06-08) Bug Fixes * Required options added via pytest_addoption will no longer prevent using –help without passing them. * Respect python_files in assertion rewriting. * Fix recursion error detection when frames in the traceback contain objects that can’t be compared (like numpy arrays). * UnicodeWarning is issued from the internal pytest warnings plugin only when the message contains non-ascii unicode (Python 2 only). * Added a workaround for Python 3.6 WindowsConsoleIO breaking due to Pytests’s FDCapture. Other code using console handles might still be affected by the very same issue and might require further workarounds/fixes, i.e. colorama.
Pytest 3.1.1 (2017-05-30) Bug Fixes * pytest warning capture no longer overrides existing warning filters. The previous behaviour would override all filters and caused regressions in test suites which configure warning filters to match their needs. Note that as a side-effect of this is that DeprecationWarning and PendingDeprecationWarning are no longer shown by default. * Fix issue with non-ascii contents in doctest text files. * Fix encoding errors for unicode warnings in Python 2. * pytest.deprecated_call now captures PendingDeprecationWarning in context manager form. Improved Documentation * Addition of towncrier for changelog management.
Add build dependency on py-setuptools_scm.
Chages 3.1.0: New Features * The ``pytest-warnings`` plugin has been integrated into the core, so now ``pytest`` automatica lly captures and displays warnings at the end of the test session. * Added ``junit_suite_name`` ini option to specify root `<testsuite>` name for JUnit XML reports * Added an ini option ``doctest_encoding`` to specify which encoding to use for doctest files. * ``pytest.warns`` now checks for subclass relationship rather than class equality. * ``pytest.raises`` now asserts that the error message matches a text or regex with the ``match`` keyword argument. * ``pytest.param`` can be used to declare test parameter sets with marks and test ids.
Updated py-test to 3.0.7. 3.0.7 (2017-03-14) ================== * Fix issue in assertion rewriting breaking due to modules silently discarding other modules when importing fails Notably, importing the `anydbm` module is fixed. (`#2248`_). Thanks `@pfhayes`_ for the PR. * junitxml: Fix problematic case where system-out tag occured twice per testcase element in the XML report. Thanks `@kkoukiou`_ for the PR. * Fix regression, pytest now skips unittest correctly if run with ``--pdb`` (`#2137`_). Thanks to `@gst`_ for the report and `@mbyt`_ for the PR. * Ignore exceptions raised from descriptors (e.g. properties) during Python test collection (`#2234`_). Thanks to `@bluetech`_. * ``--override-ini`` now correctly overrides some fundamental options like ``python_files`` (`#2238`_). Thanks `@sirex`_ for the report and `@nicoddemus`_ for the PR. * Replace ``raise StopIteration`` usages in the code by simple ``returns`` to finish generators, in accordance to `PEP-479`_ (`#2160`_). Thanks `@tgoodlet`_ for the report and `@nicoddemus`_ for the PR. * Fix internal errors when an unprintable ``AssertionError`` is raised inside a test. Thanks `@omerhadari`_ for the PR. * Skipping plugin now also works with test items generated by custom collectors (`#2231`_). Thanks to `@vidartf`_. * Fix trailing whitespace in console output if no .ini file presented (`#2281`_). Thanks `@fbjorn`_ for the PR. * Conditionless ``xfail`` markers no longer rely on the underlying test item being an instance of ``PyobjMixin``, and can therefore apply to tests not collected by the built-in python test collector. Thanks `@barneygale`_ for the PR.
Updated py-test to 3.0.6. 3.0.6 (2017-01-29) ======================= * pytest no longer generates ``PendingDeprecationWarning`` from its own operations, which was introduced by mistake in version ``3.0.5`` (`#2118`_). Thanks to `@nicoddemus`_ for the report and `@RonnyPfannschmidt`_ for the PR. * pytest no longer recognizes coroutine functions as yield tests (`#2129`_). Thanks to `@malinoff`_ for the PR. * Plugins loaded by the ``PYTEST_PLUGINS`` environment variable are now automatically considered for assertion rewriting (`#2185`_). Thanks `@nicoddemus`_ for the PR. * Improve error message when pytest.warns fails (`#2150`_). The type(s) of the expected warnings and the list of caught warnings is added to the error message. Thanks `@lesteve`_ for the PR. * Fix ``pytester`` internal plugin to work correctly with latest versions of ``zope.interface`` (`#1989`_). Thanks `@nicoddemus`_ for the PR. * Assert statements of the ``pytester`` plugin again benefit from assertion rewriting (`#1920`_). Thanks `@RonnyPfannschmidt`_ for the report and `@nicoddemus`_ for the PR. * Specifying tests with colons like ``test_foo.py::test_bar`` for tests in subdirectories with ini configuration files now uses the correct ini file (`#2148`_). Thanks `@pelme`_. * Fail ``testdir.runpytest().assert_outcomes()`` explicitly if the pytest terminal output it relies on is missing. Thanks to `@eli-b`_ for the PR.
Use "${MV} || ${TRUE}" and "${RM} -f" consistently in post-install targets.
Updated py-test to 3.0.5. 3.0.5 ===== * Add warning when not passing ``option=value`` correctly to ``-o/--override-ini`` (`#2105`_). Also improved the help documentation. Thanks to `@mbukatov`_ for the report and `@lwm`_ for the PR. * Now ``--confcutdir`` and ``--junit-xml`` are properly validated if they are directories and filenames, respectively (`#2089`_ and `#2078`_). Thanks to `@lwm`_ for the PR. * Add hint to error message hinting possible missing ``__init__.py`` (`#478`_). Thanks `@DuncanBetts`_. * More accurately describe when fixture finalization occurs in documentation (`#687`_). Thanks `@DuncanBetts`_. * Provide ``:ref:`` targets for ``recwarn.rst`` so we can use intersphinx referencing. Thanks to `@dupuy`_ for the report and `@lwm`_ for the PR. * In Python 2, use a simple ``+-`` ASCII string in the string representation of ``pytest.approx`` (for example ``"4 +- 4.0e-06"``) because it is brittle to handle that in different contexts and representations internally in pytest which can result in bugs such as `#2111`_. In Python 3, the representation still uses ``±`` (for example ``4 ± 4.0e-06``). Thanks `@kerrick-lyft`_ for the report and `@nicoddemus`_ for the PR. * Using ``item.Function``, ``item.Module``, etc., is now issuing deprecation warnings, prefer ``pytest.Function``, ``pytest.Module``, etc., instead (`#2034`_). Thanks `@nmundar`_ for the PR. * Fix error message using ``approx`` with complex numbers (`#2082`_). Thanks `@adler-j`_ for the report and `@nicoddemus`_ for the PR. * Fixed false-positives warnings from assertion rewrite hook for modules imported more than once by the ``pytest_plugins`` mechanism. Thanks `@nicoddemus`_ for the PR. * Remove an internal cache which could cause hooks from ``conftest.py`` files in sub-directories to be called in other directories incorrectly (`#2016`_). Thanks `@d-b-w`_ for the report and `@nicoddemus`_ for the PR. * Remove internal code meant to support earlier Python 3 versions that produced the side effect of leaving ``None`` in ``sys.modules`` when expressions were evaluated by pytest (for example passing a condition as a string to ``pytest.mark.skipif``)(`#2103`_). Thanks `@jaraco`_ for the report and `@nicoddemus`_ for the PR. * Cope gracefully with a .pyc file with no matching .py file (`#2038`_). Thanks `@nedbat`_.
Updated py-test to 3.0.4. 3.0.4 ===== * Import errors when collecting test modules now display the full traceback (`#1976`_). Thanks `@cwitty`_ for the report and `@nicoddemus`_ for the PR. * Fix confusing command-line help message for custom options with two or more ``metavar`` properties (`#2004`_). Thanks `@okulynyak`_ and `@davehunt`_ for the report and `@nicoddemus`_ for the PR. * When loading plugins, import errors which contain non-ascii messages are now properly handled in Python 2 (`#1998`_). Thanks `@nicoddemus`_ for the PR. * Fixed cyclic reference when ``pytest.raises`` is used in context-manager form (`#1965`_). Also as a result of this fix, ``sys.exc_info()`` is left empty in both context-manager and function call usages. Previously, ``sys.exc_info`` would contain the exception caught by the context manager, even when the expected exception occurred. Thanks `@MSeifert04`_ for the report and the PR. * Fixed false-positives warnings from assertion rewrite hook for modules that were rewritten but were later marked explicitly by ``pytest.register_assert_rewrite`` or implicitly as a plugin (`#2005`_). Thanks `@RonnyPfannschmidt`_ for the report and `@nicoddemus`_ for the PR. * Report teardown output on test failure (`#442`_). Thanks `@matclab`_ or the PR. * Fix teardown error message in generated xUnit XML. Thanks `@gdyuldin`_ or the PR. * Properly handle exceptions in ``multiprocessing`` tasks (`#1984`_). Thanks `@adborden`_ for the report and `@nicoddemus`_ for the PR. * Clean up unittest TestCase objects after tests are complete (`#1649`_). Thanks `@d_b_w`_ for the report and PR.
Updated py-test to 3.0.3. 3.0.3 ===== * The ``ids`` argument to ``parametrize`` again accepts ``unicode`` strings in Python 2 (`#1905`_). Thanks `@philpep`_ for the report and `@nicoddemus`_ for the PR. * Assertions are now being rewritten for plugins in development mode (``pip install -e``) (`#1934`_). Thanks `@nicoddemus`_ for the PR. * Fix pkg_resources import error in Jython projects (`#1853`). Thanks `@raquel-ucl`_ for the PR. * Got rid of ``AttributeError: 'Module' object has no attribute '_obj'`` exception in Python 3 (`#1944`_). Thanks `@axil`_ for the PR. * Explain a bad scope value passed to ``@fixture`` declarations or a ``MetaFunc.parametrize()`` call. Thanks `@tgoodlet`_ for the PR. * This version includes ``pluggy-0.4.0``, which correctly handles ``VersionConflict`` errors in plugins (`#704`_). Thanks `@nicoddemus`_ for the PR.
Updated py-test to 3.0.2. 3.0.2 ===== * Improve error message when passing non-string ids to ``pytest.mark.parametrize`` (`#1857`_). Thanks `@okken`_ for the report and `@nicoddemus`_ for the PR. * Add ``buffer`` attribute to stdin stub class ``pytest.capture.DontReadFromInput`` Thanks `@joguSD`_ for the PR. * Fix ``UnicodeEncodeError`` when string comparison with unicode has failed. (`#1864`_) Thanks `@AiOO`_ for the PR. * ``pytest_plugins`` is now handled correctly if defined as a string (as opposed as a sequence of strings) when modules are considered for assertion rewriting. Due to this bug, much more modules were being rewritten than necessary if a test suite uses ``pytest_plugins`` to load internal plugins (`#1888`_). Thanks `@jaraco`_ for the report and `@nicoddemus`_ for the PR (`#1891`_). * Do not call tearDown and cleanups when running tests from ``unittest.TestCase`` subclasses with ``--pdb`` enabled. This allows proper post mortem debugging for all applications which have significant logic in their tearDown machinery (`#1890`_). Thanks `@mbyt`_ for the PR. * Fix use of deprecated ``getfuncargvalue`` method in the internal doctest plugin. Thanks `@ViviCoder`_ for the report (`#1898`_).
Updated py-test to 3.0.1. 3.0.1 ===== * Fix regression when ``importorskip`` is used at module level (`#1822`_). Thanks `@jaraco`_ and `@The-Compiler`_ for the report and `@nicoddemus`_ for the PR. * Fix parametrization scope when session fixtures are used in conjunction with normal parameters in the same call (`#1832`_). Thanks `@The-Compiler`_ for the report, `@Kingdread`_ and `@nicoddemus`_ for the PR. * Fix internal error when parametrizing tests or fixtures using an empty ``ids`` argument (`#1849`_). Thanks `@OPpuolitaival`_ for the report and `@nicoddemus`_ for the PR. * Fix loader error when running ``pytest`` embedded in a zipfile. Thanks `@mbachry`_ for the PR. .. _@Kingdread: https://github.com/Kingdread .. _@mbachry: https://github.com/mbachry .. _@OPpuolitaival: https://github.com/OPpuolitaival .. _#1822: https://github.com/pytest-dev/pytest/issues/1822 .. _#1832: https://github.com/pytest-dev/pytest/issues/1832 .. _#1849: https://github.com/pytest-dev/pytest/issues/1849
Remove unnecessary PLIST_SUBST and FILES_SUBST that are now provided by the infrastructure. Mark a couple more packages as not ready for python-3.x.
Fix typo in ALTERNATIVES file. Bump PKGREVISION.
Updated py-test to 3.0.0. Add ALTERNATIVES file. 3.0.0 ===== **Incompatible changes** A number of incompatible changes were made in this release, with the intent of removing features deprecated for a long time or change existing behaviors in order to make them less surprising/more useful. * Reinterpretation mode has now been removed. Only plain and rewrite mode are available, consequently the ``--assert=reinterp`` option is no longer available. Thanks `@flub`_ for the PR. * The following deprecated commandline options were removed: * ``--genscript``: no longer supported; * ``--no-assert``: use ``--assert=plain`` instead; * ``--nomagic``: use ``--assert=plain`` instead; * ``--report``: use ``-r`` instead; Thanks to `@RedBeardCode`_ for the PR (`#1664`_). * ImportErrors in plugins now are a fatal error instead of issuing a pytest warning (`#1479`_). Thanks to `@The-Compiler`_ for the PR. * Removed support code for Python 3 versions < 3.3 (`#1627`_). * Removed all ``py.test-X*`` entry points. The versioned, suffixed entry points were never documented and a leftover from a pre-virtualenv era. These entry points also created broken entry points in wheels, so removing them also removes a source of confusion for users (`#1632`_). Thanks `@obestwalter`_ for the PR. * ``pytest.skip()`` now raises an error when used to decorate a test function, as opposed to its original intent (to imperatively skip a test inside a test function). Previously this usage would cause the entire module to be skipped (`#607`_). Thanks `@omarkohl`_ for the complete PR (`#1519`_). * Exit tests if a collection error occurs. A poll indicated most users will hit CTRL-C anyway as soon as they see collection errors, so pytest might as well make that the default behavior (`#1421`_). A ``--continue-on-collection-errors`` option has been added to restore the previous behaviour. Thanks `@olegpidsadnyi`_ and `@omarkohl`_ for the complete PR (`#1628`_). * Renamed the pytest ``pdb`` module (plugin) into ``debugging`` to avoid clashes with the builtin ``pdb`` module. * Raise a helpful failure message when requesting a parametrized fixture at runtime, e.g. with ``request.getfixturevalue``. Previously these parameters were simply never defined, so a fixture decorated like ``@pytest.fixture(params=[0, 1, 2])`` only ran once (`#460`_). Thanks to `@nikratio`_ for the bug report, `@RedBeardCode`_ and `@tomviner`_ for the PR. * ``_pytest.monkeypatch.monkeypatch`` class has been renamed to ``_pytest.monkeypatch.MonkeyPatch`` so it doesn't conflict with the ``monkeypatch`` fixture. * ``--exitfirst / -x`` can now be overridden by a following ``--maxfail=N`` and is just a synonym for ``--maxfail=1``. **New Features** * Support nose-style ``__test__`` attribute on methods of classes, including unittest-style Classes. If set to ``False``, the test will not be collected. * New ``doctest_namespace`` fixture for injecting names into the namespace in which doctests run. Thanks `@milliams`_ for the complete PR (`#1428`_). * New ``--doctest-report`` option available to change the output format of diffs when running (failing) doctests (implements `#1749`_). Thanks `@hartym`_ for the PR. * New ``name`` argument to ``pytest.fixture`` decorator which allows a custom name for a fixture (to solve the funcarg-shadowing-fixture problem). Thanks `@novas0x2a`_ for the complete PR (`#1444`_). * New ``approx()`` function for easily comparing floating-point numbers in tests. Thanks `@kalekundert`_ for the complete PR (`#1441`_). * Ability to add global properties in the final xunit output file by accessing the internal ``junitxml`` plugin (experimental). Thanks `@tareqalayan`_ for the complete PR `#1454`_). * New ``ExceptionInfo.match()`` method to match a regular expression on the string representation of an exception (`#372`_). Thanks `@omarkohl`_ for the complete PR (`#1502`_). * ``__tracebackhide__`` can now also be set to a callable which then can decide whether to filter the traceback based on the ``ExceptionInfo`` object passed to it. Thanks `@The-Compiler`_ for the complete PR (`#1526`_). * New ``pytest_make_parametrize_id(config, val)`` hook which can be used by plugins to provide friendly strings for custom types. Thanks `@palaviv`_ for the PR. * ``capsys`` and ``capfd`` now have a ``disabled()`` context-manager method, which can be used to temporarily disable capture within a test. Thanks `@nicoddemus`_ for the PR. * New cli flag ``--fixtures-per-test``: shows which fixtures are being used for each selected test item. Features doc strings of fixtures by default. Can also show where fixtures are defined if combined with ``-v``. Thanks `@hackebrot`_ for the PR. * Introduce ``pytest`` command as recommended entry point. Note that ``py.test`` still works and is not scheduled for removal. Closes proposal `#1629`_. Thanks `@obestwalter`_ and `@davehunt`_ for the complete PR (`#1633`_). * New cli flags: + ``--setup-plan``: performs normal collection and reports the potential setup and teardown and does not execute any fixtures and tests; + ``--setup-only``: performs normal collection, executes setup and teardown of fixtures and reports them; + ``--setup-show``: performs normal test execution and additionally shows setup and teardown of fixtures; + ``--keep-duplicates``: py.test now ignores duplicated paths given in the command line. To retain the previous behavior where the same test could be run multiple times by specifying it in the command-line multiple times, pass the ``--keep-duplicates`` argument (`#1609`_); Thanks `@d6e`_, `@kvas-it`_, `@sallner`_, `@ioggstream`_ and `@omarkohl`_ for the PRs. * New CLI flag ``--override-ini``/``-o``: overrides values from the ini file. For example: ``"-o xfail_strict=True"``'. Thanks `@blueyed`_ and `@fengxx`_ for the PR. * New hooks: + ``pytest_fixture_setup(fixturedef, request)``: executes fixture setup; + ``pytest_fixture_post_finalizer(fixturedef)``: called after the fixture's finalizer and has access to the fixture's result cache. Thanks `@d6e`_, `@sallner`_. * Issue warnings for asserts whose test is a tuple literal. Such asserts will never fail because tuples are always truthy and are usually a mistake (see `#1562`_). Thanks `@kvas-it`_, for the PR. * Allow passing a custom debugger class (e.g. ``--pdbcls=IPython.core.debugger:Pdb``). Thanks to `@anntzer`_ for the PR. **Changes** * Plugins now benefit from assertion rewriting. Thanks `@sober7`_, `@nicoddemus`_ and `@flub`_ for the PR. * Change ``report.outcome`` for ``xpassed`` tests to ``"passed"`` in non-strict mode and ``"failed"`` in strict mode. Thanks to `@hackebrot`_ for the PR (`#1795`_) and `@gprasad84`_ for report (`#1546`_). * Tests marked with ``xfail(strict=False)`` (the default) now appear in JUnitXML reports as passing tests instead of skipped. Thanks to `@hackebrot`_ for the PR (`#1795`_). * Highlight path of the file location in the error report to make it easier to copy/paste. Thanks `@suzaku`_ for the PR (`#1778`_). * Fixtures marked with ``@pytest.fixture`` can now use ``yield`` statements exactly like those marked with the ``@pytest.yield_fixture`` decorator. This change renders ``@pytest.yield_fixture`` deprecated and makes ``@pytest.fixture`` with ``yield`` statements the preferred way to write teardown code (`#1461`_). Thanks `@csaftoiu`_ for bringing this to attention and `@nicoddemus`_ for the PR. * Explicitly passed parametrize ids do not get escaped to ascii (`#1351`_). Thanks `@ceridwen`_ for the PR. * Fixtures are now sorted in the error message displayed when an unknown fixture is declared in a test function. Thanks `@nicoddemus`_ for the PR. * ``pytest_terminal_summary`` hook now receives the ``exitstatus`` of the test session as argument. Thanks `@blueyed`_ for the PR (`#1809`_). * Parametrize ids can accept ``None`` as specific test id, in which case the automatically generated id for that argument will be used. Thanks `@palaviv`_ for the complete PR (`#1468`_). * The parameter to xunit-style setup/teardown methods (``setup_method``, ``setup_module``, etc.) is now optional and may be omitted. Thanks `@okken`_ for bringing this to attention and `@nicoddemus`_ for the PR. * Improved automatic id generation selection in case of duplicate ids in parametrize. Thanks `@palaviv`_ for the complete PR (`#1474`_). * Now pytest warnings summary is shown up by default. Added a new flag ``--disable-pytest-warnings`` to explicitly disable the warnings summary (`#1668`_). * Make ImportError during collection more explicit by reminding the user to check the name of the test module/package(s) (`#1426`_). Thanks `@omarkohl`_ for the complete PR (`#1520`_). * Add ``build/`` and ``dist/`` to the default ``--norecursedirs`` list. Thanks `@mikofski`_ for the report and `@tomviner`_ for the PR (`#1544`_). * ``pytest.raises`` in the context manager form accepts a custom ``message`` to raise when no exception occurred. Thanks `@palaviv`_ for the complete PR (`#1616`_). * ``conftest.py`` files now benefit from assertion rewriting; previously it was only available for test modules. Thanks `@flub`_, `@sober7`_ and `@nicoddemus`_ for the PR (`#1619`_). * Text documents without any doctests no longer appear as "skipped". Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_). * Ensure that a module within a namespace package can be found when it is specified on the command line together with the ``--pyargs`` option. Thanks to `@taschini`_ for the PR (`#1597`_). * Always include full assertion explanation during assertion rewriting. The previous behaviour was hiding sub-expressions that happened to be ``False``, assuming this was redundant information. Thanks `@bagerard`_ for reporting (`#1503`_). Thanks to `@davehunt`_ and `@tomviner`_ for the PR. * ``OptionGroup.addoption()`` now checks if option names were already added before, to make it easier to track down issues like `#1618`_. Before, you only got exceptions later from ``argparse`` library, giving no clue about the actual reason for double-added options. * ``yield``-based tests are considered deprecated and will be removed in pytest-4.0. Thanks `@nicoddemus`_ for the PR. * ``[pytest]`` sections in ``setup.cfg`` files should now be named ``[tool:pytest]`` to avoid conflicts with other distutils commands (see `#567`_). ``[pytest]`` sections in ``pytest.ini`` or ``tox.ini`` files are supported and unchanged. Thanks `@nicoddemus`_ for the PR. * Using ``pytest_funcarg__`` prefix to declare fixtures is considered deprecated and will be removed in pytest-4.0 (`#1684`_). Thanks `@nicoddemus`_ for the PR. * Raise helpful failure message, when requesting parametrized fixture at runtime, e.g. with ``request.getfuncargvalue``. BACKWARD INCOMPAT: Previously these params were simply never defined. So a fixture decorated like ``@pytest.fixture(params=[0, 1, 2])`` only ran once. Now a failure is raised. Fixes (`#460`_). Thanks to `@nikratio`_ for bug report, `@RedBeardCode`_ and `@tomviner`_ for the PR. * Passing a command-line string to ``pytest.main()`` is considered deprecated and scheduled for removal in pytest-4.0. It is recommended to pass a list of arguments instead (`#1723`_). * Rename ``getfuncargvalue`` to ``getfixturevalue``. ``getfuncargvalue`` is still present but is now considered deprecated. Thanks to `@RedBeardCode`_ and `@tomviner`_ for the PR (`#1626`_). * ``optparse`` type usage now triggers DeprecationWarnings (`#1740`_). * ``optparse`` backward compatibility supports float/complex types (`#457`_). * Refined logic for determining the ``rootdir``, considering only valid paths which fixes a number of issues: `#1594`_, `#1435`_ and `#1471`_. Thanks to `@blueyed`_ and `@davehunt`_ for the PR. * Always include full assertion explanation. The previous behaviour was hiding sub-expressions that happened to be False, assuming this was redundant information. Thanks `@bagerard`_ for reporting (`#1503`_). Thanks to `@davehunt`_ and `@tomviner`_ for PR. * Renamed the pytest ``pdb`` module (plugin) into ``debugging``. * Better message in case of not using parametrized variable (see `#1539`_). Thanks to `@tramwaj29`_ for the PR. * Updated docstrings with a more uniform style. * Add stderr write for ``pytest.exit(msg)`` during startup. Previously the message was never shown. Thanks `@BeyondEvil`_ for reporting `#1210`_. Thanks to `@JonathonSonesen`_ and `@tomviner`_ for the PR. * No longer display the incorrect test deselection reason (`#1372`_). Thanks `@ronnypfannschmidt`_ for the PR. * The ``--resultlog`` command line option has been deprecated: it is little used and there are more modern and better alternatives (see `#830`_). Thanks `@nicoddemus`_ for the PR. * Improve error message with fixture lookup errors: add an 'E' to the first line and '>' to the rest. Fixes `#717`_. Thanks `@blueyed`_ for reporting and a PR, `@eolo999`_ for the initial PR and `@tomviner`_ for his guidance during EuroPython2016 sprint. **Bug Fixes** * Parametrize now correctly handles duplicated test ids. * Fix internal error issue when the ``method`` argument is missing for ``teardown_method()`` (`#1605`_). * Fix exception visualization in case the current working directory (CWD) gets deleted during testing (`#1235`_). Thanks `@bukzor`_ for reporting. PR by `@marscher`_. * Improve test output for logical expression with brackets (`#925`_). Thanks `@DRMacIver`_ for reporting and `@RedBeardCode`_ for the PR. * Create correct diff for strings ending with newlines (`#1553`_). Thanks `@Vogtinator`_ for reporting and `@RedBeardCode`_ and `@tomviner`_ for the PR. * ``ConftestImportFailure`` now shows the traceback making it easier to identify bugs in ``conftest.py`` files (`#1516`_). Thanks `@txomon`_ for the PR. * Add an 'E' to the first line of error messages from FixtureLookupErrorRepr. Fixes `#717`_. Thanks `@blueyed`_ for reporting, `@eolo999`_ for the PR and `@tomviner`_ for his guidance during EuroPython2016 sprint. * Text documents without any doctests no longer appear as "skipped". Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_). * Fixed collection of classes with custom ``__new__`` method. Fixes `#1579`_. Thanks to `@Stranger6667`_ for the PR. * Fixed scope overriding inside metafunc.parametrize (`#634`_). Thanks to `@Stranger6667`_ for the PR. * Fixed the total tests tally in junit xml output (`#1798`_). Thanks to `@cryporchild`_ for the PR. * Fixed off-by-one error with lines from ``request.node.warn``. Thanks to `@blueyed`_ for the PR.
Updated py-test to 2.9.2. 2.9.2 ===== **Bug Fixes** * fix `#510`_: skip tests where one parameterize dimension was empty thanks Alex Stapleton for the Report and `@RonnyPfannschmidt`_ for the PR * Fix Xfail does not work with condition keyword argument. Thanks `@astraw38`_ for reporting the issue (`#1496`_) and `@tomviner`_ for PR the (`#1524`_). * Fix win32 path issue when puttinging custom config file with absolute path in ``pytest.main("-c your_absolute_path")``. * Fix maximum recursion depth detection when raised error class is not aware of unicode/encoded bytes. Thanks `@prusse-martin`_ for the PR (`#1506`_). * Fix ``pytest.mark.skip`` mark when used in strict mode. Thanks `@pquentin`_ for the PR and `@RonnyPfannschmidt`_ for showing how to fix the bug. * Minor improvements and fixes to the documentation. Thanks `@omarkohl`_ for the PR. * Fix ``--fixtures`` to show all fixture definitions as opposed to just one per fixture name. Thanks to `@hackebrot`_ for the PR. .. _#510: https://github.com/pytest-dev/pytest/issues/510 .. _#1506: https://github.com/pytest-dev/pytest/pull/1506 .. _#1496: https://github.com/pytest-dev/pytest/issue/1496 .. _#1524: https://github.com/pytest-dev/pytest/issue/1524 .. _@prusse-martin: https://github.com/prusse-martin .. _@astraw38: https://github.com/astraw38
Update py-test to 2.9.1. 2.9.1 ===== **Bug Fixes** * Improve error message when a plugin fails to load. Thanks `@nicoddemus`_ for the PR. * Fix (`#1178 <https://github.com/pytest-dev/pytest/issues/1178>`_): ``pytest.fail`` with non-ascii characters raises an internal pytest error. Thanks `@nicoddemus`_ for the PR. * Fix (`#469`_): junit parses report.nodeid incorrectly, when params IDs contain ``::``. Thanks `@tomviner`_ for the PR (`#1431`_). * Fix (`#578 <https://github.com/pytest-dev/pytest/issues/578>`_): SyntaxErrors containing non-ascii lines at the point of failure generated an internal py.test error. Thanks `@asottile`_ for the report and `@nicoddemus`_ for the PR. * Fix (`#1437`_): When passing in a bytestring regex pattern to parameterize attempt to decode it as utf-8 ignoring errors. * Fix (`#649`_): parametrized test nodes cannot be specified to run on the command line. .. _#1437: https://github.com/pytest-dev/pytest/issues/1437 .. _#469: https://github.com/pytest-dev/pytest/issues/469 .. _#1431: https://github.com/pytest-dev/pytest/pull/1431 .. _#649: https://github.com/pytest-dev/pytest/issues/649 .. _@asottile: https://github.com/asottile 2.9.0 ===== **New Features** * New ``pytest.mark.skip`` mark, which unconditionally skips marked tests. Thanks `@MichaelAquilina`_ for the complete PR (`#1040`_). * ``--doctest-glob`` may now be passed multiple times in the command-line. Thanks `@jab`_ and `@nicoddemus`_ for the PR. * New ``-rp`` and ``-rP`` reporting options give the summary and full output of passing tests, respectively. Thanks to `@codewarrior0`_ for the PR. * ``pytest.mark.xfail`` now has a ``strict`` option, which makes ``XPASS`` tests to fail the test suite (defaulting to ``False``). There's also a ``xfail_strict`` ini option that can be used to configure it project-wise. Thanks `@rabbbit`_ for the request and `@nicoddemus`_ for the PR (`#1355`_). * ``Parser.addini`` now supports options of type ``bool``. Thanks `@nicoddemus`_ for the PR. * New ``ALLOW_BYTES`` doctest option. This strips ``b`` prefixes from byte strings in doctest output (similar to ``ALLOW_UNICODE``). Thanks `@jaraco`_ for the request and `@nicoddemus`_ for the PR (`#1287`_). * Give a hint on ``KeyboardInterrupt`` to use the ``--fulltrace`` option to show the errors. Fixes `#1366`_. Thanks to `@hpk42`_ for the report and `@RonnyPfannschmidt`_ for the PR. * Catch ``IndexError`` exceptions when getting exception source location. Fixes a pytest internal error for dynamically generated code (fixtures and tests) where source lines are fake by intention. **Changes** * **Important**: `py.code <http://pylib.readthedocs.org/en/latest/code.html>`_ has been merged into the ``pytest`` repository as ``pytest._code``. This decision was made because ``py.code`` had very few uses outside ``pytest`` and the fact that it was in a different repository made it difficult to fix bugs on its code in a timely manner. The team hopes with this to be able to better refactor out and improve that code. This change shouldn't affect users, but it is useful to let users aware if they encounter any strange behavior. Keep in mind that the code for ``pytest._code`` is **private** and **experimental**, so you definitely should not import it explicitly! Please note that the original ``py.code`` is still available in `pylib <http://pylib.readthedocs.org>`_. * ``pytest_enter_pdb`` now optionally receives the pytest config object. Thanks `@nicoddemus`_ for the PR. * Removed code and documentation for Python 2.5 or lower versions, including removal of the obsolete ``_pytest.assertion.oldinterpret`` module. Thanks `@nicoddemus`_ for the PR (`#1226`_). * Comparisons now always show up in full when ``CI`` or ``BUILD_NUMBER`` is found in the environment, even when ``-vv`` isn't used. Thanks `@The-Compiler`_ for the PR. * ``--lf`` and ``--ff`` now support long names: ``--last-failed`` and ``--failed-first`` respectively. Thanks `@MichaelAquilina`_ for the PR. * Added expected exceptions to ``pytest.raises`` fail message. * Collection only displays progress ("collecting X items") when in a terminal. This avoids cluttering the output when using ``--color=yes`` to obtain colors in CI integrations systems (`#1397`_). **Bug Fixes** * The ``-s`` and ``-c`` options should now work under ``xdist``; ``Config.fromdictargs`` now represents its input much more faithfully. Thanks to `@bukzor`_ for the complete PR (`#680`_). * Fix (`#1290`_): support Python 3.5's ``@`` operator in assertion rewriting. Thanks `@Shinkenjoe`_ for report with test case and `@tomviner`_ for the PR. * Fix formatting utf-8 explanation messages (`#1379`_). Thanks `@biern`_ for the PR. * Fix `traceback style docs`_ to describe all of the available options (auto/long/short/line/native/no), with `auto` being the default since v2.6. Thanks `@hackebrot`_ for the PR. * Fix (`#1422`_): junit record_xml_property doesn't allow multiple records with same name. .. _`traceback style docs`: https://pytest.org/latest/usage.html#modifying-python-traceback-printing .. _#1422: https://github.com/pytest-dev/pytest/issues/1422 .. _#1379: https://github.com/pytest-dev/pytest/issues/1379 .. _#1366: https://github.com/pytest-dev/pytest/issues/1366 .. _#1040: https://github.com/pytest-dev/pytest/pull/1040 .. _#680: https://github.com/pytest-dev/pytest/issues/680 .. _#1287: https://github.com/pytest-dev/pytest/pull/1287 .. _#1226: https://github.com/pytest-dev/pytest/pull/1226 .. _#1290: https://github.com/pytest-dev/pytest/pull/1290 .. _#1355: https://github.com/pytest-dev/pytest/pull/1355 .. _#1397: https://github.com/pytest-dev/pytest/issues/1397 .. _@biern: https://github.com/biern .. _@MichaelAquilina: https://github.com/MichaelAquilina .. _@bukzor: https://github.com/bukzor .. _@hpk42: https://github.com/hpk42 .. _@nicoddemus: https://github.com/nicoddemus .. _@jab: https://github.com/jab .. _@codewarrior0: https://github.com/codewarrior0 .. _@jaraco: https://github.com/jaraco .. _@The-Compiler: https://github.com/The-Compiler .. _@Shinkenjoe: https://github.com/Shinkenjoe .. _@tomviner: https://github.com/tomviner .. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt .. _@rabbbit: https://github.com/rabbbit .. _@hackebrot: https://github.com/hackebrot
Update py-test to 2.8.7. All self-tests pass. 2.8.7 ---------- - fix #1338: use predictable object resolution for monkeypatch
Update py-test to 2.8.6: 2.8.6 ----- - fix #1259: allow for double nodeids in junitxml, this was a regression failing plugins combinations like pytest-pep8 + pytest-flakes - Workaround for exception that occurs in pyreadline when using ``--pdb`` with standard I/O capture enabled. Thanks Erik M. Bray for the PR. - fix #900: Better error message in case the target of a ``monkeypatch`` call raises an ``ImportError``. - fix #1292: monkeypatch calls (setattr, setenv, etc.) are now O(1). Thanks David R. MacIver for the report and Bruno Oliveira for the PR. - fix #1223: captured stdout and stderr are now properly displayed before entering pdb when ``--pdb`` is used instead of being thrown away. Thanks Cal Leeming for the PR. - fix #1305: pytest warnings emitted during ``pytest_terminal_summary`` are now properly displayed. Thanks Ionel Maries Cristian for the report and Bruno Oliveira for the PR. - fix #628: fixed internal UnicodeDecodeError when doctests contain unicode. Thanks Jason R. Coombs for the report and Bruno Oliveira for the PR. - fix #1334: Add captured stdout to jUnit XML report on setup error. Thanks Georgy Dyuldin for the PR. 2.8.5 ----- - fix #1243: fixed issue where class attributes injected during collection could break pytest. PR by Alexei Kozlenok, thanks Ronny Pfannschmidt and Bruno Oliveira for the review and help. - fix #1074: precompute junitxml chunks instead of storing the whole tree in objects Thanks Bruno Oliveira for the report and Ronny Pfannschmidt for the PR - fix #1238: fix ``pytest.deprecated_call()`` receiving multiple arguments (Regression introduced in 2.8.4). Thanks Alex Gaynor for the report and Bruno Oliveira for the PR. 2.8.4 ----- - fix #1190: ``deprecated_call()`` now works when the deprecated function has been already called by another test in the same module. Thanks Mikhail Chernykh for the report and Bruno Oliveira for the PR. - fix #1198: ``--pastebin`` option now works on Python 3. Thanks Mehdy Khoshnoody for the PR. - fix #1219: ``--pastebin`` now works correctly when captured output contains non-ascii characters. Thanks Bruno Oliveira for the PR. - fix #1204: another error when collecting with a nasty __getattr__(). Thanks Florian Bruhin for the PR. - fix the summary printed when no tests did run. Thanks Florian Bruhin for the PR. - fix #1185 - ensure MANIFEST.in exactly matches what should go to a sdist - a number of documentation modernizations wrt good practices. Thanks Bruno Oliveira for the PR.
Update py-test to 2.8.3. All tests pass. 2.8.3 ----- - fix #1169: add __name__ attribute to testcases in TestCaseFunction to support the @unittest.skip decorator on functions and methods. Thanks Lee Kamentsky for the PR. - fix #1035: collecting tests if test module level obj has __getattr__(). Thanks Suor for the report and Bruno Oliveira / Tom Viner for the PR. - fix #331: don't collect tests if their failure cannot be reported correctly e.g. they are a callable instance of a class. - fix #1133: fixed internal error when filtering tracebacks where one entry belongs to a file which is no longer available. Thanks Bruno Oliveira for the PR. - enhancement made to highlight in red the name of the failing tests so they stand out in the output. Thanks Gabriel Reis for the PR. - add more talks to the documentation - extend documentation on the --ignore cli option - use pytest-runner for setuptools integration - minor fixes for interaction with OS X El Capitan system integrity protection (thanks Florian)
Update py-test to 2.8.2: 2.8.2 ----- - fix #1085: proper handling of encoding errors when passing encoded byte strings to pytest.parametrize in Python 2. Thanks Themanwithoutaplan for the report and Bruno Oliveira for the PR. - fix #1087: handling SystemError when passing empty byte strings to pytest.parametrize in Python 3. Thanks Paul Kehrer for the report and Bruno Oliveira for the PR. - fix #995: fixed internal error when filtering tracebacks where one entry was generated by an exec() statement. Thanks Daniel Hahler, Ashley C Straw, Philippe Gauthier and Pavel Savchenko for contributing and Bruno Oliveira for the PR. 2.8.1 ----- - fix #1034: Add missing nodeid on pytest_logwarning call in addhook. Thanks Simon Gomizelj for the PR. - 'deprecated_call' is now only satisfied with a DeprecationWarning or PendingDeprecationWarning. Before 2.8.0, it accepted any warning, and 2.8.0 made it accept only DeprecationWarning (but not PendingDeprecationWarning). Thanks Alex Gaynor for the issue and Eric Hunsberger for the PR. - fix issue #1073: avoid calling __getattr__ on potential plugin objects. This fixes an incompatibility with pytest-django. Thanks Andreas Pelme, Bruno Oliveira and Ronny Pfannschmidt for contributing and Holger Krekel for the fix. - Fix issue #704: handle versionconflict during plugin loading more gracefully. Thanks Bruno Oliveira for the PR. - Fix issue #1064: ""--junitxml" regression when used with the "pytest-xdist" plugin, with test reports being assigned to the wrong tests. Thanks Daniel Grunwald for the report and Bruno Oliveira for the PR. - (experimental) adapt more SEMVER style versioning and change meaning of master branch in git repo: "master" branch now keeps the bugfixes, changes aimed for micro releases. "features" branch will only be be released with minor or major pytest releases. - Fix issue #766 by removing documentation references to distutils. Thanks Russel Winder. - Fix issue #1030: now byte-strings are escaped to produce item node ids to make them always serializable. Thanks Andy Freeland for the report and Bruno Oliveira for the PR. - Python 2: if unicode parametrized values are convertible to ascii, their ascii representation is used for the node id. - Fix issue #411: Add __eq__ method to assertion comparison example. Thanks Ben Webb. - fix issue 877: properly handle assertion explanations with non-ascii repr Thanks Mathieu Agopian for the report and Ronny Pfannschmidt for the PR. - fix issue 1029: transform errors when writing cache values into pytest-warnings 2.8.0 ----------------------------- - new ``--lf`` and ``-ff`` options to run only the last failing tests or "failing tests first" from the last run. This functionality is provided through porting the formerly external pytest-cache plugin into pytest core. BACKWARD INCOMPAT: if you used pytest-cache's functionality to persist data between test runs be aware that we don't serialize sets anymore. Thanks Ronny Pfannschmidt for most of the merging work. - "-r" option now accepts "a" to include all possible reports, similar to passing "fEsxXw" explicitly (isse960). Thanks Abhijeet Kasurde for the PR. - avoid python3.5 deprecation warnings by introducing version specific inspection helpers, thanks Michael Droettboom. - fix issue562: @nose.tools.istest now fully respected. - fix issue934: when string comparison fails and a diff is too large to display without passing -vv, still show a few lines of the diff. Thanks Florian Bruhin for the report and Bruno Oliveira for the PR. - fix issue736: Fix a bug where fixture params would be discarded when combined with parametrization markers. Thanks to Markus Unterwaditzer for the PR. - fix issue710: introduce ALLOW_UNICODE doctest option: when enabled, the ``u`` prefix is stripped from unicode strings in expected doctest output. This allows doctests which use unicode to run in Python 2 and 3 unchanged. Thanks Jason R. Coombs for the report and Bruno Oliveira for the PR. - parametrize now also generates meaningful test IDs for enum, regex and class objects (as opposed to class instances). Thanks to Florian Bruhin for the PR. - Add 'warns' to assert that warnings are thrown (like 'raises'). Thanks to Eric Hunsberger for the PR. - Fix issue683: Do not apply an already applied mark. Thanks ojake for the PR. - Deal with capturing failures better so fewer exceptions get lost to /dev/null. Thanks David Szotten for the PR. - fix issue730: deprecate and warn about the --genscript option. Thanks Ronny Pfannschmidt for the report and Christian Pommranz for the PR. - fix issue751: multiple parametrize with ids bug if it parametrizes class with two or more test methods. Thanks Sergey Chipiga for reporting and Jan Bednarik for PR. - fix issue82: avoid loading conftest files from setup.cfg/pytest.ini/tox.ini files and upwards by default (--confcutdir can still be set to override this). Thanks Bruno Oliveira for the PR. - fix issue768: docstrings found in python modules were not setting up session fixtures. Thanks Jason R. Coombs for reporting and Bruno Oliveira for the PR. - added `tmpdir_factory`, a session-scoped fixture that can be used to create directories under the base temporary directory. Previously this object was installed as a `_tmpdirhandler` attribute of the `config` object, but now it is part of the official API and using `config._tmpdirhandler` is deprecated. Thanks Bruno Oliveira for the PR. - fix issue808: pytest's internal assertion rewrite hook now implements the optional PEP302 get_data API so tests can access data files next to them. Thanks xmo-odoo for request and example and Bruno Oliveira for the PR. - rootdir and inifile are now displayed during usage errors to help users diagnose problems such as unexpected ini files which add unknown options being picked up by pytest. Thanks to Pavel Savchenko for bringing the problem to attention in #821 and Bruno Oliveira for the PR. - Summary bar now is colored yellow for warning situations such as: all tests either were skipped or xpass/xfailed, or no tests were run at all (this is a partial fix for issue500). - fix issue812: pytest now exits with status code 5 in situations where no tests were run at all, such as the directory given in the command line does not contain any tests or as result of a command line option filters all out all tests (-k for example). Thanks Eric Siegerman (issue812) and Bruno Oliveira for the PR. - Summary bar now is colored yellow for warning situations such as: all tests either were skipped or xpass/xfailed, or no tests were run at all (related to issue500). Thanks Eric Siegerman. - New `testpaths` ini option: list of directories to search for tests when executing pytest from the root directory. This can be used to speed up test collection when a project has well specified directories for tests, being usually more practical than configuring norecursedirs for all directories that do not contain tests. Thanks to Adrian for idea (#694) and Bruno Oliveira for the PR. - fix issue713: JUnit XML reports for doctest failures. Thanks Punyashloka Biswal. - fix issue970: internal pytest warnings now appear as "pytest-warnings" in the terminal instead of "warnings", so it is clear for users that those warnings are from pytest and not from the builtin "warnings" module. Thanks Bruno Oliveira. - Include setup and teardown in junitxml test durations. Thanks Janne Vanhala. - fix issue735: assertion failures on debug versions of Python 3.4+ - new option ``--import-mode`` to allow to change test module importing behaviour to append to sys.path instead of prepending. This better allows to run test modules against installated versions of a package even if the package under test has the same import root. In this example:: testing/__init__.py testing/test_pkg_under_test.py pkg_under_test/ the tests will run against the installed version of pkg_under_test when ``--import-mode=append`` is used whereas by default they would always pick up the local version. Thanks Holger Krekel. - pytester: add method ``TmpTestdir.delete_loaded_modules()``, and call it from ``inline_run()`` to allow temporary modules to be reloaded. Thanks Eduardo Schettino. - internally refactor pluginmanager API and code so that there is a clear distinction between a pytest-agnostic rather simple pluginmanager and the PytestPluginManager which adds a lot of behaviour, among it handling of the local conftest files. In terms of documented methods this is a backward compatible change but it might still break 3rd party plugins which relied on details like especially the pluginmanager.add_shutdown() API. Thanks Holger Krekel. - pluginmanagement: introduce ``pytest.hookimpl`` and ``pytest.hookspec`` decorators for setting impl/spec specific parameters. This substitutes the previous now deprecated use of ``pytest.mark`` which is meant to contain markers for test functions only. - write/refine docs for "writing plugins" which now have their own page and are separate from the "using/installing plugins`` page. - fix issue732: properly unregister plugins from any hook calling sites allowing to have temporary plugins during test execution. - deprecate and warn about ``__multicall__`` argument in hook implementations. Use the ``hookwrapper`` mechanism instead already introduced with pytest-2.7. - speed up pytest's own test suite considerably by using inprocess tests by default (testrun can be modified with --runpytest=subprocess to create subprocesses in many places instead). The main APIs to run pytest in a test is "runpytest()" or "runpytest_subprocess" and "runpytest_inprocess" if you need a particular way of running the test. In all cases you get back a RunResult but the inprocess one will also have a "reprec" attribute with the recorded events/reports. - fix monkeypatch.setattr("x.y", raising=False) to actually not raise if "y" is not a pre-existing attribute. Thanks Florian Bruhin. - fix issue741: make running output from testdir.run copy/pasteable Thanks Bruno Oliveira. - add a new ``--noconftest`` argument which ignores all ``conftest.py`` files. - add ``file`` and ``line`` attributes to JUnit-XML output. - fix issue890: changed extension of all documentation files from ``txt`` to ``rst``. Thanks to Abhijeet for the PR. - fix issue714: add ability to apply indirect=True parameter on particular argnames. Thanks Elizaveta239. - fix issue890: changed extension of all documentation files from ``txt`` to ``rst``. Thanks to Abhijeet for the PR. - fix issue957: "# doctest: SKIP" option will now register doctests as SKIPPED rather than PASSED. Thanks Thomas Grainger for the report and Bruno Oliveira for the PR. - issue951: add new record_xml_property fixture, that supports logging additional information on xml output. Thanks David Diaz for the PR. - issue949: paths after normal options (for example `-s`, `-v`, etc) are now properly used to discover `rootdir` and `ini` files. Thanks Peter Lauri for the report and Bruno Oliveira for the PR. 2.7.3 (compared to 2.7.2) ----------------------------- - Allow 'dev', 'rc', or other non-integer version strings in `importorskip`. Thanks to Eric Hunsberger for the PR. - fix issue856: consider --color parameter in all outputs (for example --fixtures). Thanks Barney Gale for the report and Bruno Oliveira for the PR. - fix issue855: passing str objects as `plugins` argument to pytest.main is now interpreted as a module name to be imported and registered as a plugin, instead of silently having no effect. Thanks xmo-odoo for the report and Bruno Oliveira for the PR. - fix issue744: fix for ast.Call changes in Python 3.5+. Thanks Guido van Rossum, Matthias Bussonnier, Stefan Zimmermann and Thomas Kluyver. - fix issue842: applying markers in classes no longer propagate this markers to superclasses which also have markers. Thanks xmo-odoo for the report and Bruno Oliveira for the PR. - preserve warning functions after call to pytest.deprecated_call. Thanks Pieter Mulder for PR. - fix issue854: autouse yield_fixtures defined as class members of unittest.TestCase subclasses now work as expected. Thannks xmo-odoo for the report and Bruno Oliveira for the PR. - fix issue833: --fixtures now shows all fixtures of collected test files, instead of just the fixtures declared on the first one. Thanks Florian Bruhin for reporting and Bruno Oliveira for the PR. - fix issue863: skipped tests now report the correct reason when a skip/xfail condition is met when using multiple markers. Thanks Raphael Pierzina for reporting and Bruno Oliveira for the PR. - optimized tmpdir fixture initialization, which should make test sessions faster (specially when using pytest-xdist). The only visible effect is that now pytest uses a subdirectory in the $TEMP directory for all directories created by this fixture (defaults to $TEMP/pytest-$USER). Thanks Bruno Oliveira for the PR.
Update to 2.7.2: 2.7.2 (compared to 2.7.1) ----------------------------- - fix issue767: pytest.raises value attribute does not contain the exception instance on Python 2.6. Thanks Eric Siegerman for providing the test case and Bruno Oliveira for PR. - Automatically create directory for junitxml and results log. Thanks Aron Curzon. - fix issue713: JUnit XML reports for doctest failures. Thanks Punyashloka Biswal. - fix issue735: assertion failures on debug versions of Python 3.4+ Thanks Benjamin Peterson. - fix issue114: skipif marker reports to internal skipping plugin; Thanks Floris Bruynooghe for reporting and Bruno Oliveira for the PR. - fix issue748: unittest.SkipTest reports to internal pytest unittest plugin. Thanks Thomas De Schampheleire for reporting and Bruno Oliveira for the PR. - fix issue718: failed to create representation of sets containing unsortable elements in python 2. Thanks Edison Gustavo Muenz - fix issue756, fix issue752 (and similar issues): depend on py-1.4.29 which has a refined algorithm for traceback generation.
Update to 2.7.1: 2.7.1 (compared to 2.7.0) ----------------------------- - fix issue731: do not get confused by the braces which may be present and unbalanced in an object's repr while collapsing False explanations. Thanks Carl Meyer for the report and test case. - fix issue553: properly handling inspect.getsourcelines failures in FixtureLookupError which would lead to to an internal error, obfuscating the original problem. Thanks talljosh for initial diagnose/patch and Bruno Oliveira for final patch. - fix issue660: properly report scope-mismatch-access errors independently from ordering of fixture arguments. Also avoid the pytest internal traceback which does not provide information to the user. Thanks Holger Krekel. - streamlined and documented release process. Also all versions (in setup.py and documentation generation) are now read from _pytest/__init__.py. Thanks Holger Krekel. - fixed docs to remove the notion that yield-fixtures are experimental. They are here to stay :) Thanks Bruno Oliveira. - Support building wheels by using environment markers for the requirements. Thanks Ionel Maries Cristian. - fixed regression to 2.6.4 which surfaced e.g. in lost stdout capture printing when tests raised SystemExit. Thanks Holger Krekel. - reintroduced _pytest fixture of the pytester plugin which is used at least by pytest-xdist.
Update to 2.7.0: 2.7.0 (compared to 2.6.4) ----------------------------- - fix issue435: make reload() work when assert rewriting is active. Thanks Daniel Hahler. - fix issue616: conftest.py files and their contained fixutres are now properly considered for visibility, independently from the exact current working directory and test arguments that are used. Many thanks to Eric Siegerman and his PR235 which contains systematic tests for conftest visibility and now passes. This change also introduces the concept of a ``rootdir`` which is printed as a new pytest header and documented in the pytest customize web page. - change reporting of "diverted" tests, i.e. tests that are collected in one file but actually come from another (e.g. when tests in a test class come from a base class in a different file). We now show the nodeid and indicate via a postfix the other file. - add ability to set command line options by environment variable PYTEST_ADDOPTS. - added documentation on the new pytest-dev teams on bitbucket and github. See https://pytest.org/latest/contributing.html . Thanks to Anatoly for pushing and initial work on this. - fix issue650: new option ``--docttest-ignore-import-errors`` which will turn import errors in doctests into skips. Thanks Charles Cloud for the complete PR. - fix issue655: work around different ways that cause python2/3 to leak sys.exc_info into fixtures/tests causing failures in 3rd party code - fix issue615: assertion re-writing did not correctly escape % signs when formatting boolean operations, which tripped over mixing booleans with modulo operators. Thanks to Tom Viner for the report, triaging and fix. - implement issue351: add ability to specify parametrize ids as a callable to generate custom test ids. Thanks Brianna Laugher for the idea and implementation. - introduce and document new hookwrapper mechanism useful for plugins which want to wrap the execution of certain hooks for their purposes. This supersedes the undocumented ``__multicall__`` protocol which pytest itself and some external plugins use. Note that pytest-2.8 is scheduled to drop supporting the old ``__multicall__`` and only support the hookwrapper protocol. - majorly speed up invocation of plugin hooks - use hookwrapper mechanism in builtin pytest plugins. - add a doctest ini option for doctest flags, thanks Holger Peters. - add note to docs that if you want to mark a parameter and the parameter is a callable, you also need to pass in a reason to disambiguate it from the "decorator" case. Thanks Tom Viner. - "python_classes" and "python_functions" options now support glob-patterns for test discovery, as discussed in issue600. Thanks Ldiary Translations. - allow to override parametrized fixtures with non-parametrized ones and vice versa (bubenkoff). - fix issue463: raise specific error for 'parameterize' misspelling (pfctdayelise). - On failure, the ``sys.last_value``, ``sys.last_type`` and ``sys.last_traceback`` are set, so that a user can inspect the error via postmortem debugging (almarklein).
Update to 2.6.4: 2.6.4 ---------- - Improve assertion failure reporting on iterables, by using ndiff and pprint. - removed outdated japanese docs from source tree. - docs for "pytest_addhooks" hook. Thanks Bruno Oliveira. - updated plugin index docs. Thanks Bruno Oliveira. - fix issue557: with "-k" we only allow the old style "-" for negation at the beginning of strings and even that is deprecated. Use "not" instead. This should allow to pick parametrized tests where "-" appeared in the parameter. - fix issue604: Escape % character in the assertion message. - fix issue620: add explanation in the --genscript target about what the binary blob means. Thanks Dinu Gherman. - fix issue614: fixed pastebin support.
Update to 2.6.3: 2.6.3 ----------- - fix issue575: xunit-xml was reporting collection errors as failures instead of errors, thanks Oleg Sinyavskiy. - fix issue582: fix setuptools example, thanks Laszlo Papp and Ronny Pfannschmidt. - Fix infinite recursion bug when pickling capture.EncodedFile, thanks Uwe Schmitt. - fix issue589: fix bad interaction with numpy and others when showing exceptions. Check for precise "maximum recursion depth exceed" exception instead of presuming any RuntimeError is that one (implemented in py dep). Thanks Charles Cloud for analysing the issue. - fix conftest related fixture visibility issue: when running with a CWD outside a test package pytest would get fixture discovery wrong. Thanks to Wolfgang Schnerring for figuring out a reproducable example. - Introduce pytest_enter_pdb hook (needed e.g. by pytest_timeout to cancel the timeout when interactively entering pdb). Thanks Wolfgang Schnerring. - check xfail/skip also with non-python function test items. Thanks Floris Bruynooghe.
Update to 2.6.2: 2.6.2 ----------- - Added function pytest.freeze_includes(), which makes it easy to embed pytest into executables using tools like cx_freeze. See docs for examples and rationale. Thanks Bruno Oliveira. - Improve assertion rewriting cache invalidation precision. - fixed issue561: adapt autouse fixture example for python3. - fixed issue453: assertion rewriting issue with __repr__ containing "\n{", "\n}" and "\n~". - fix issue560: correctly display code if an "else:" or "finally:" is followed by statements on the same line. - Fix example in monkeypatch documentation, thanks t-8ch. - fix issue572: correct tmpdir doc example for python3. - Do not mark as universal wheel because Python 2.6 is different from other builds due to the extra argparse dependency. Fixes issue566. Thanks sontek.
Update to 2.6.1: 2.6.1 ----------------------------------- - No longer show line numbers in the --verbose output, the output is now purely the nodeid. The line number is still shown in failure reports. Thanks Floris Bruynooghe. - fix issue437 where assertion rewriting could cause pytest-xdist slaves to collect different tests. Thanks Bruno Oliveira. - fix issue555: add "errors" attribute to capture-streams to satisfy some distutils and possibly other code accessing sys.stdout.errors. - fix issue547 capsys/capfd also work when output capturing ("-s") is disabled. - address issue170: allow pytest.mark.xfail(...) to specify expected exceptions via an optional "raises=EXC" argument where EXC can be a single exception or a tuple of exception classes. Thanks David Mohr for the complete PR. - fix integration of pytest with unittest.mock.patch decorator when it uses the "new" argument. Thanks Nicolas Delaby for test and PR. - fix issue with detecting conftest files if the arguments contain "::" node id specifications (copy pasted from "-v" output) - fix issue544 by only removing "@NUM" at the end of "::" separated parts and if the part has an ".py" extension - don't use py.std import helper, rather import things directly. Thanks Bruno Oliveira.
Update to 2.6.0: NEXT (2.6) ----------------------------------- - Cache exceptions from fixtures according to their scope (issue 467). - fix issue537: Avoid importing old assertion reinterpretation code by default. - fix issue364: shorten and enhance tracebacks representation by default. The new "--tb=auto" option (default) will only display long tracebacks for the first and last entry. You can get the old behaviour of printing all entries as long entries with "--tb=long". Also short entries by default are now printed very similarly to "--tb=native" ones. - fix issue514: teach assertion reinterpretation about private class attributes - change -v output to include full node IDs of tests. Users can copy a node ID from a test run, including line number, and use it as a positional argument in order to run only a single test. - fix issue 475: fail early and comprehensible if calling pytest.raises with wrong exception type. - fix issue516: tell in getting-started about current dependencies. - cleanup setup.py a bit and specify supported versions. Thanks Jurko Gospodnetic for the PR. - change XPASS colour to yellow rather then red when tests are run with -v. - fix issue473: work around mock putting an unbound method into a class dict when double-patching. - fix issue498: if a fixture finalizer fails, make sure that the fixture is still invalidated. - fix issue453: the result of the pytest_assertrepr_compare hook now gets it's newlines escaped so that format_exception does not blow up. - internal new warning system: pytest will now produce warnings when it detects oddities in your test collection or execution. Warnings are ultimately sent to a new pytest_logwarning hook which is currently only implemented by the terminal plugin which displays warnings in the summary line and shows more details when -rw (report on warnings) is specified. - change skips into warnings for test classes with an __init__ and callables in test modules which look like a test but are not functions. - fix issue436: improved finding of initial conftest files from command line arguments by using the result of parse_known_args rather than the previous flaky heuristics. Thanks Marc Abramowitz for tests and initial fixing approaches in this area. - fix issue #479: properly handle nose/unittest(2) SkipTest exceptions during collection/loading of test modules. Thanks to Marc Schlaich for the complete PR. - fix issue490: include pytest_load_initial_conftests in documentation and improve docstring. - fix issue472: clarify that ``pytest.config.getvalue()`` cannot work if it's triggered ahead of command line parsing. - merge PR123: improved integration with mock.patch decorator on tests. - fix issue412: messing with stdout/stderr FD-level streams is now captured without crashes. - fix issue483: trial/py33 works now properly. Thanks Daniel Grana for PR. - improve example for pytest integration with "python setup.py test" which now has a generic "-a" or "--pytest-args" option where you can pass additional options as a quoted string. Thanks Trevor Bekolay. - simplified internal capturing mechanism and made it more robust against tests or setups changing FD1/FD2, also better integrated now with pytest.pdb() in single tests. - improvements to pytest's own test-suite leakage detection, courtesy of PRs from Marc Abramowitz - fix issue492: avoid leak in test_writeorg. Thanks Marc Abramowitz. - fix issue493: don't run tests in doc directory with ``python setup.py test`` (use tox -e doctesting for that) - fix issue486: better reporting and handling of early conftest loading failures - some cleanup and simplification of internal conftest handling. - work a bit harder to break reference cycles when catching exceptions. Thanks Jurko Gospodnetic. - fix issue443: fix skip examples to use proper comparison. Thanks Alex Groenholm. - support nose-style ``__test__`` attribute on modules, classes and functions, including unittest-style Classes. If set to False, the test will not be collected. - fix issue512: show "<notset>" for arguments which might not be set in monkeypatch plugin. Improves output in documentation.
Depend on py-1.4.20. Bump PKGREVISION.
Update to 2.5.2 (leaf package). Add missing dependencies. Add test dependencies. Replace interpreter path in installed file. Changes since 2.3.5: 2.5.2 ----------------------------------- - fix issue409 -- better interoperate with cx_freeze by not trying to import from collections.abc which causes problems for py27/cx_freeze. Thanks Wolfgang L. for reporting and tracking it down. - fixed docs and code to use "pytest" instead of "py.test" almost everywhere. Thanks Jurko Gospodnetic for the complete PR. - fix issue425: mention at end of "py.test -h" that --markers and --fixtures work according to specified test path (or current dir) - fix issue413: exceptions with unicode attributes are now printed correctly also on python2 and with pytest-xdist runs. (the fix requires py-1.4.20) - copy, cleanup and integrate py.io capture from pylib 1.4.20.dev2 (rev 13d9af95547e) - address issue416: clarify docs as to conftest.py loading semantics - fix issue429: comparing byte strings with non-ascii chars in assert expressions now work better. Thanks Floris Bruynooghe. - make capfd/capsys.capture private, its unused and shouldnt be exposed 2.5.1 ----------------------------------- - merge new documentation styling PR from Tobias Bieniek. - fix issue403: allow parametrize of multiple same-name functions within a collection node. Thanks Andreas Kloeckner and Alex Gaynor for reporting and analysis. - Allow parameterized fixtures to specify the ID of the parameters by adding an ids argument to pytest.fixture() and pytest.yield_fixture(). Thanks Floris Bruynooghe. - fix issue404 by always using the binary xml escape in the junitxml plugin. Thanks Ronny Pfannschmidt. - fix issue407: fix addoption docstring to point to argparse instead of optparse. Thanks Daniel D. Wright. 2.5.0 ----------------------------------- - dropped python2.5 from automated release testing of pytest itself which means it's probably going to break soon (but still works with this release we believe). - simplified and fixed implementation for calling finalizers when parametrized fixtures or function arguments are involved. finalization is now performed lazily at setup time instead of in the "teardown phase". While this might sound odd at first, it helps to ensure that we are correctly handling setup/teardown even in complex code. User-level code should not be affected unless it's implementing the pytest_runtest_teardown hook and expecting certain fixture instances are torn down within (very unlikely and would have been unreliable anyway). - PR90: add --color=yes|no|auto option to force terminal coloring mode ("auto" is default). Thanks Marc Abramowitz. - fix issue319 - correctly show unicode in assertion errors. Many thanks to Floris Bruynooghe for the complete PR. Also means we depend on py>=1.4.19 now. - fix issue396 - correctly sort and finalize class-scoped parametrized tests independently from number of methods on the class. - refix issue323 in a better way -- parametrization should now never cause Runtime Recursion errors because the underlying algorithm for re-ordering tests per-scope/per-fixture is not recursive anymore (it was tail-call recursive before which could lead to problems for more than >966 non-function scoped parameters). - fix issue290 - there is preliminary support now for parametrizing with repeated same values (sometimes useful to to test if calling a second time works as with the first time). - close issue240 - document precisely how pytest module importing works, discuss the two common test directory layouts, and how it interacts with PEP420-namespace packages. - fix issue246 fix finalizer order to be LIFO on independent fixtures depending on a parametrized higher-than-function scoped fixture. (was quite some effort so please bear with the complexity of this sentence :) Thanks Ralph Schmitt for the precise failure example. - fix issue244 by implementing special index for parameters to only use indices for paramentrized test ids - fix issue287 by running all finalizers but saving the exception from the first failing finalizer and re-raising it so teardown will still have failed. We reraise the first failing exception because it might be the cause for other finalizers to fail. - fix ordering when mock.patch or other standard decorator-wrappings are used with test methods. This fixues issue346 and should help with random "xdist" collection failures. Thanks to Ronny Pfannschmidt and Donald Stufft for helping to isolate it. - fix issue357 - special case "-k" expressions to allow for filtering with simple strings that are not valid python expressions. Examples: "-k 1.3" matches all tests parametrized with 1.3. "-k None" filters all tests that have "None" in their name and conversely "-k 'not None'". Previously these examples would raise syntax errors. - fix issue384 by removing the trial support code since the unittest compat enhancements allow trial to handle it on its own - don't hide an ImportError when importing a plugin produces one. fixes issue375. - fix issue275 - allow usefixtures and autouse fixtures for running doctest text files. - fix issue380 by making --resultlog only rely on longrepr instead of the "reprcrash" attribute which only exists sometimes. - address issue122: allow @pytest.fixture(params=iterator) by exploding into a list early on. - fix pexpect-3.0 compatibility for pytest's own tests. (fixes issue386) - allow nested parametrize-value markers, thanks James Lan for the PR. - fix unicode handling with new monkeypatch.setattr(import_path, value) API. Thanks Rob Dennis. Fixes issue371. - fix unicode handling with junitxml, fixes issue368. - In assertion rewriting mode on Python 2, fix the detection of coding cookies. See issue #330. - make "--runxfail" turn imperative pytest.xfail calls into no ops (it already did neutralize pytest.mark.xfail markers) - refine pytest / pkg_resources interactions: The AssertionRewritingHook PEP302 compliant loader now registers itself with setuptools/pkg_resources properly so that the pkg_resources.resource_stream method works properly. Fixes issue366. Thanks for the investigations and full PR to Jason R. Coombs. - pytestconfig fixture is now session-scoped as it is the same object during the whole test run. Fixes issue370. - avoid one surprising case of marker malfunction/confusion:: @pytest.mark.some(lambda arg: ...) def test_function(): would not work correctly because pytest assumes @pytest.mark.some gets a function to be decorated already. We now at least detect if this arg is an lambda and thus the example will work. Thanks Alex Gaynor for bringing it up. - xfail a test on pypy that checks wrong encoding/ascii (pypy does not error out). fixes issue385. - internally make varnames() deal with classes's __init__, although it's not needed by pytest itself atm. Also fix caching. Fixes issue376. - fix issue221 - handle importing of namespace-package with no __init__.py properly. - refactor internal FixtureRequest handling to avoid monkeypatching. One of the positive user-facing effects is that the "request" object can now be used in closures. - fixed version comparison in pytest.importskip(modname, minverstring) - fix issue377 by clarifying in the nose-compat docs that pytest does not duplicate the unittest-API into the "plain" namespace. - fix verbose reporting for @mock'd test functions v2.4.2 ----------------------------------- - on Windows require colorama and a newer py lib so that py.io.TerminalWriter() now uses colorama instead of its own ctypes hacks. (fixes issue365) thanks Paul Moore for bringing it up. - fix "-k" matching of tests where "repr" and "attr" and other names would cause wrong matches because of an internal implementation quirk (don't ask) which is now properly implemented. fixes issue345. - avoid tmpdir fixture to create too long filenames especially when parametrization is used (issue354) - fix pytest-pep8 and pytest-flakes / pytest interactions (collection names in mark plugin was assuming an item always has a function which is not true for those plugins etc.) Thanks Andi Zeidler. - introduce node.get_marker/node.add_marker API for plugins like pytest-pep8 and pytest-flakes to avoid the messy details of the node.keywords pseudo-dicts. Adapated docs. - remove attempt to "dup" stdout at startup as it's icky. the normal capturing should catch enough possibilities of tests messing up standard FDs. - add pluginmanager.do_configure(config) as a link to config.do_configure() for plugin-compatibility v2.4.1 ----------------------------------- - When using parser.addoption() unicode arguments to the "type" keyword should also be converted to the respective types. thanks Floris Bruynooghe, @dnozay. (fixes issue360 and issue362) - fix dotted filename completion when using argcomplete thanks Anthon van der Neuth. (fixes issue361) - fix regression when a 1-tuple ("arg",) is used for specifying parametrization (the values of the parametrization were passed nested in a tuple). Thanks Donald Stufft. - merge doc typo fixes, thanks Andy Dirnberger v2.4 ----------------------------------- known incompatibilities: - if calling --genscript from python2.7 or above, you only get a standalone script which works on python2.7 or above. Use Python2.6 to also get a python2.5 compatible version. - all xunit-style teardown methods (nose-style, pytest-style, unittest-style) will not be called if the corresponding setup method failed, see issue322 below. - the pytest_plugin_unregister hook wasn't ever properly called and there is no known implementation of the hook - so it got removed. - pytest.fixture-decorated functions cannot be generators (i.e. use yield) anymore. This change might be reversed in 2.4.1 if it causes unforeseen real-life issues. However, you can always write and return an inner function/generator and change the fixture consumer to iterate over the returned generator. This change was done in lieu of the new ``pytest.yield_fixture`` decorator, see below. new features: - experimentally introduce a new ``pytest.yield_fixture`` decorator which accepts exactly the same parameters as pytest.fixture but mandates a ``yield`` statement instead of a ``return statement`` from fixture functions. This allows direct integration with "with-style" context managers in fixture functions and generally avoids registering of finalization callbacks in favour of treating the "after-yield" as teardown code. Thanks Andreas Pelme, Vladimir Keleshev, Floris Bruynooghe, Ronny Pfannschmidt and many others for discussions. - allow boolean expression directly with skipif/xfail if a "reason" is also specified. Rework skipping documentation to recommend "condition as booleans" because it prevents surprises when importing markers between modules. Specifying conditions as strings will remain fully supported. - reporting: color the last line red or green depending if failures/errors occured or everything passed. thanks Christian Theunert. - make "import pdb ; pdb.set_trace()" work natively wrt capturing (no "-s" needed anymore), making ``pytest.set_trace()`` a mere shortcut. - fix issue181: --pdb now also works on collect errors (and on internal errors) . This was implemented by a slight internal refactoring and the introduction of a new hook ``pytest_exception_interact`` hook (see next item). - fix issue341: introduce new experimental hook for IDEs/terminals to intercept debugging: ``pytest_exception_interact(node, call, report)``. - new monkeypatch.setattr() variant to provide a shorter invocation for patching out classes/functions from modules: monkeypatch.setattr("requests.get", myfunc) will replace the "get" function of the "requests" module with ``myfunc``. - fix issue322: tearDownClass is not run if setUpClass failed. Thanks Mathieu Agopian for the initial fix. Also make all of pytest/nose finalizer mimick the same generic behaviour: if a setupX exists and fails, don't run teardownX. This internally introduces a new method "node.addfinalizer()" helper which can only be called during the setup phase of a node. - simplify pytest.mark.parametrize() signature: allow to pass a CSV-separated string to specify argnames. For example: ``pytest.mark.parametrize("input,expected", [(1,2), (2,3)])`` works as well as the previous: ``pytest.mark.parametrize(("input", "expected"), ...)``. - add support for setUpModule/tearDownModule detection, thanks Brian Okken. - integrate tab-completion on options through use of "argcomplete". Thanks Anthon van der Neut for the PR. - change option names to be hyphen-separated long options but keep the old spelling backward compatible. py.test -h will only show the hyphenated version, for example "--collect-only" but "--collectonly" will remain valid as well (for backward-compat reasons). Many thanks to Anthon van der Neut for the implementation and to Hynek Schlawack for pushing us. - fix issue 308 - allow to mark/xfail/skip individual parameter sets when parametrizing. Thanks Brianna Laugher. - call new experimental pytest_load_initial_conftests hook to allow 3rd party plugins to do something before a conftest is loaded. Bug fixes: - fix issue358 - capturing options are now parsed more properly by using a new parser.parse_known_args method. - pytest now uses argparse instead of optparse (thanks Anthon) which means that "argparse" is added as a dependency if installing into python2.6 environments or below. - fix issue333: fix a case of bad unittest/pytest hook interaction. - PR27: correctly handle nose.SkipTest during collection. Thanks Antonio Cuni, Ronny Pfannschmidt. - fix issue355: junitxml puts name="pytest" attribute to testsuite tag. - fix issue336: autouse fixture in plugins should work again. - fix issue279: improve object comparisons on assertion failure for standard datatypes and recognise collections.abc. Thanks to Brianna Laugher and Mathieu Agopian. - fix issue317: assertion rewriter support for the is_package method - fix issue335: document py.code.ExceptionInfo() object returned from pytest.raises(), thanks Mathieu Agopian. - remove implicit distribute_setup support from setup.py. - fix issue305: ignore any problems when writing pyc files. - SO-17664702: call fixture finalizers even if the fixture function partially failed (finalizers would not always be called before) - fix issue320 - fix class scope for fixtures when mixed with module-level functions. Thanks Anatloy Bubenkoff. - you can specify "-q" or "-qq" to get different levels of "quieter" reporting (thanks Katarzyna Jachim) - fix issue300 - Fix order of conftest loading when starting py.test in a subdirectory. - fix issue323 - sorting of many module-scoped arg parametrizations - make sessionfinish hooks execute with the same cwd-context as at session start (helps fix plugin behaviour which write output files with relative path such as pytest-cov) - fix issue316 - properly reference collection hooks in docs - fix issue 306 - cleanup of -k/-m options to only match markers/test names/keywords respectively. Thanks Wouter van Ackooy. - improved doctest counting for doctests in python modules -- files without any doctest items will not show up anymore and doctest examples are counted as separate test items. thanks Danilo Bellini. - fix issue245 by depending on the released py-1.4.14 which fixes py.io.dupfile to work with files with no mode. Thanks Jason R. Coombs. - fix junitxml generation when test output contains control characters, addressing issue267, thanks Jaap Broekhuizen - fix issue338: honor --tb style for setup/teardown errors as well. Thanks Maho. - fix issue307 - use yaml.safe_load in example, thanks Mark Eichin. - better parametrize error messages, thanks Brianna Laugher - pytest_terminal_summary(terminalreporter) hooks can now use ".section(title)" and ".line(msg)" methods to print extra information at the end of a test run.
add pytest-2.3.5, another Python testing framework