github pytest-dev/pytest 7.3.0

latest releases: 8.3.3, 8.3.2, 8.4.0.dev0...
19 months ago

pytest 7.3.0 (2023-04-08)

Features

  • #10525: 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.
  • #10755: console_output_style{.interpreted-text role="confval"} 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.
  • #7431: --log-disable CLI option added to disable individual loggers.
  • #8141: Added tmp_path_retention_count{.interpreted-text role="confval"} and tmp_path_retention_policy{.interpreted-text role="confval"} configuration options to control how directories created by the tmp_path{.interpreted-text role="fixture"} fixture are kept.

Improvements

  • #10226: If multiple errors are raised in teardown, we now re-raise an ExceptionGroup of them instead of discarding all but the last.
  • #10658: Allow -p arguments to include spaces (eg: -p no:logging instead of
    -pno:logging). Mostly useful in the addopts section of the configuration
    file.
  • #10710: Added start and stop timestamps to TestReport objects.
  • #10727: Split the report header for rootdir, config file and testpaths so each has its own line.
  • #10840: pytest should no longer crash on AST with pathological position attributes, for example testing AST produced by [Hylang <https://github.com/hylang/hy>__]{.title-ref}.
  • #6267: 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

  • #10743: The assertion rewriting mechanism now works correctly when assertion expressions contain the walrus operator.
  • #10765: Fixed tmp_path{.interpreted-text role="fixture"} fixture always raising OSError{.interpreted-text role="class"} on emscripten platform due to missing os.getuid{.interpreted-text role="func"}.
  • #1904: Correctly handle __tracebackhide__ for chained exceptions.

Improved Documentation

  • #10782: Fixed the minimal example in goodpractices{.interpreted-text role="ref"}: pip install -e . requires a version entry in pyproject.toml to run successfully.

Trivial/Internal Changes

  • #10669: pytest no longer depends on the [attrs]{.title-ref} package (don't worry, nice diffs for attrs classes are still supported).

Don't miss a new pytest release

NewReleases is sending notifications on new releases.