release-2.7.0.rst

Overview

This file is the release notes for **pytest version 2.7.0**, a mature Python testing framework widely used for writing and running test cases. The document summarizes the key fixes, new features, improvements, and important changes introduced in this release compared to the previous version 2.6.4.

pytest is known for its simple syntax, powerful fixtures, and extensive plugin system. This release focuses on enhancing reliability (fixing bugs), improving performance (speeding up plugin hook invocation), and extending functionality (new command-line options, better test discovery, and plugin hook mechanisms).

These release notes serve as a changelog and upgrade guide for users and plugin developers who want to understand what has changed, what issues were fixed, and what new capabilities are now available.


Detailed Explanation of Contents

Since this file is a plain text changelog rather than code, it contains no classes, functions, or methods. Instead, it documents the changes made in the pytest codebase in version 2.7.0.

Below is a detailed breakdown of the main topics covered:

Fixes and Bug Resolutions

New Features and Improvements


Usage Examples

Though this file does not contain executable code, here are examples of how some of the new features might be used in pytest test suites or configurations:

  1. Using PYTEST_ADDOPTS to set CLI options:

export PYTEST_ADDOPTS="--maxfail=2 --strict"
pytest

This will apply the options as if passed on the command line.

  1. Using callable for parametrize ids:

def id_func(param):
    return f"id_{param}"

@pytest.mark.parametrize("input", [1, 2, 3], ids=id_func)
def test_example(input):
    assert input > 0

This generates custom test IDs like `id_1`, `id_2`, etc.

  1. Ignoring import errors in doctests:

Run pytest with:

pytest --doctest-ignore-import-errors

This makes doctests skip over import errors instead of failing.


Implementation Details and Algorithms


Interaction with Other Parts of the System


Mermaid Diagram: Structure of release-2.7.0.rst

The file is a changelog document, so a **flowchart** representing the main topics of the release and their relationships is most appropriate.

flowchart TD
    A[pytest 2.7.0 Release Notes] --> B[Fixes and Bug Resolutions]
    A --> C[New Features and Improvements]
    A --> D[Usage Examples]
    A --> E[Implementation Details]
    A --> F[System Interaction]

    B --> B1[Reload fix with assert rewriting]
    B --> B2[Conftest.py fixture visibility]
    B --> B3[Diverted tests reporting]
    B --> B4[Doctest import errors skip]
    B --> B5[Sys.exc_info leak fix]
    B --> B6[Assertion rewriting escape fix]
    B --> B7[Parameterize misspelling error]
    B --> B8[Postmortem debugging]

    C --> C1[PYTEST_ADDOPTS env variable]
    C --> C2[Parametrize ids callable]
    C --> C3[Hookwrapper mechanism]
    C --> C4[Speed improvements]
    C --> C5[Doctest ini option]
    C --> C6[Test discovery glob patterns]
    C --> C7[Parametrized fixture overrides]
    C --> C8[Documentation updates]

Summary

This release notes file documents important fixes, enhancements, and new features introduced in pytest 2.7.0. It is an essential reference for users upgrading from 2.6.x, plugin developers adapting to new hook mechanisms, and contributors keeping track of project evolution. The file itself is a human-readable changelog without executable code but reflects substantial internal improvements and user-facing capabilities in the pytest testing tool.