release-2.3.4.rst

Overview

The [release-2.3.4.rst](/projects/286/66986) file is a release note document for the `pytest` testing framework, specifically detailing changes introduced in version 2.3.4. This file serves as an informational summary for users and developers, highlighting new features, bug fixes, and important usage notes that accompany the release.

Rather than containing executable code, this file is intended as a human-readable changelog to communicate enhancements and fixes that improve stability and usability of the `pytest` tool.

Key functionalities and improvements described include:

This file is part of the documentation suite that assists users in upgrading and utilizing the new features and fixes in pytest 2.3.4.


Detailed Explanation

Content Type

This file is a **release note / changelog**, formatted using reStructuredText (`.rst`), a common markup language in Python projects for documentation.

Purpose and Usage

Main Sections and Highlights

  1. Release Title and Version

    • pytest-2.3.4: stabilization, more flexible selection via "-k expr"

  2. Release Description

    • Describes pytest as a tool offering simple assertions, fixture scalability, and customization.

    • Emphasizes that 2.3.4 is a stabilization release with incremental improvements.

  3. New Features and Fixes

    • -k option enhancement:

      • Now accepts logical expressions similar to -m.

      • Usage example: -k "name1 or name2".

      • Backward compatibility note: To match specific methods in classes, use -k "TestClass and test_method".

    • Dynamic Marker Definition:

      • Users can define markers dynamically via item.keywords[...] = assignment.

      • This integrates with the -m selection option.

    • Yielded Tests and Fixtures:

      • Yielded tests now activate autouse fixtures.

      • Yielded tests cannot accept fixtures as function arguments (funcargs).

      • Recommended to use parameterize features instead of yield, with documentation link provided.

    • Autouse Fixture Fixes:

      • Fixes issues where autouse fixtures in conftest.py were not discovered in some test directories.

    • Fixture Teardown Ordering:

      • Ensures fixture teardown follows Last-In-First-Out (LIFO) order.

    • Argument Length Fix:

      • Fixes command invocations with arguments longer than 256 characters.

    • Package/Directory Setup Examples:

      • Adds or discusses examples for package/directory-level setup.

    • Additional Autouse Discovery Fixes

  4. Acknowledgements

    • Thanks contributors, notably Thomas Waldmann, for reporting issues.

  5. References and Installation Instructions

    • Points users to the official pytest website: http://pytest.org/.

    • Installation and upgrade commands via pip or easy_install.


Implementation Details and Algorithms

As this is a release note document and not source code, it does not contain implementation code or algorithms. However, it references improvements in pytest’s internal behavior and mechanisms, such as:

These reflect underlying changes to the pytest core but are not detailed here.


Interactions with Other System Components


Usage Example of Key Feature (`-k` option)

# Select tests whose names contain 'login' or 'signup'
pytest -k "login or signup"

# Select tests defined in TestUser class and the method test_create
pytest -k "TestUser and test_create"

Visual Diagram

Since this file is documentation describing a release, a **flowchart** illustrating the main features and how they relate to test selection and fixture management in pytest 2.3.4 is most relevant.

flowchart TD
    A[pytest-2.3.4 Release] --> B[-k option enhanced]
    A --> C[Dynamic marker definition]
    A --> D[Yielded tests with autouse fixtures]
    A --> E[Fixture teardown LIFO ordering]
    A --> F[Autouse fixture discovery fixes]
    A --> G[Argument length fix (>256 chars)]
    B --> B1["-k" accepts expressions]
    B1 --> B2["Usage: -k \"name1 or name2\""]
    D --> D1[Yielded tests activate autouse fixtures]
    D --> D2[Yielded tests cannot accept funcargs]
    F --> F1[Fix discovery in conftest.py vs tests]

Summary

The [release-2.3.4.rst](/projects/286/66986) file is a concise, user-facing changelog documenting improvements and fixes in pytest 2.3.4. It primarily focuses on enhanced test selection flexibility, fixture management stability, and bug fixes to improve testing workflows. This documentation is essential for users upgrading pytest to adapt to new behaviors and leverage improved features efficiently.