release-2.3.1.rst
Overview
This file is the release notes documentation for **pytest version 2.3.1**, a minor update to the widely used Python testing framework `pytest`. It serves as a changelog and quick guide highlighting important fixes, improvements, and instructions relevant to this particular release.
The primary purpose of this file is to inform users and developers about the bug fixes and enhancements included in version 2.3.1, especially addressing a regression issue with fixture (factory) functions, platform-specific test behavior adjustments, and documentation improvements.
It is not a source code file but rather a structured text file (in reStructuredText format) intended to be consumed by developers and users to understand what changed from version 2.3.0 to 2.3.1.
Content Summary
Fixes a regression (issue202) related to fixture functions using
selfDisables certain
pexpect-based self tests on FreeBSD systems to prevent hangsImproves interactive documentation output related to
--markersoptionProvides upgrade/install instructions using
piporeasy_installReferences the official pytest website for further information
Detailed Explanations
Regression Fix: issue202
Problem: In previous versions, specifically after 2.2.4, using
selfinside fixture functions or factory functions caused a regression that broke expected behavior.Fix: This release restores the behavior so that the
selfinstance seen inside fixture functions is the same instance a test method sees, aligning with the behavior in pytest 2.2.4.Impact: Users relying on class-based fixtures or factory functions that access
selfcan safely upgrade without breaking their test suites.
Platform-Specific Test Adjustment
Context: The
pexpectlibrary is used by pytest for interactive test sessions, such as debugging (test_pdb.py).Issue: On FreeBSD systems,
pexpectdoes not support certain features properly, causing test hangs.Change: The release disables
pexpect-based self tests on FreeBSD to avoid these hangs, improving test suite stability.
Documentation Improvement: --markers
Enhancement: When using the
--markersoption, pytest now links output to helpful web pages explaining pytest.mark.* usage.Benefit: This assists users in understanding marker functionality interactively, improving discoverability and usability.
Installation Instructions
The release notes remind users how to install or upgrade pytest:
pip install -U pytest
# or
easy_install -U pytest
This ensures users can easily move to the latest version.
Implementation Details & Algorithms
This file is a release note and does not contain executable code or algorithms. Instead, it documents changes made in source code elsewhere in the pytest project.
The main technical detail is the fix for the `self` regression in fixture functions, which internally relates to pytest's fixture handling and test class instance management. While not detailed here, it likely involves ensuring fixture factories correctly receive or bind the test class instance (`self`) as context.
Interaction with Other System Parts
pytest Core: The fix affects pytest’s core fixture management system, impacting how test classes and fixtures interact.
Test Suite: The adjustments to pexpect tests influence the pytest test suite itself, ensuring it runs reliably on FreeBSD.
Documentation System: The enhanced
--markersoutput connects the CLI tool to online documentation resources, improving user assistance.Installation Tools: The instructions reference Python package management tools (
pip,easy_install), indicating interactions with Python’s packaging ecosystem.
Visual Diagram
Since this file is primarily a changelog/release note, a flowchart illustrating the key updates and their relationships provides the clearest structural overview.
flowchart TD
A[pytest-2.3.1 Release]
A --> B[Fix Regression: issue202]
B --> B1[Restore 'self' in fixture funcs]
A --> C[Disable pexpect tests on FreeBSD]
C --> C1[Prevent test hangs]
A --> D[Improve --markers docs]
D --> D1[Add links to online help]
A --> E[Install/Upgrade instructions]
E --> E1[pip install -U pytest]
E --> E2[easy_install -U pytest]
Usage Example
This file itself is not executable but to benefit from the fixes and improvements described:
Upgrade pytest to version 2.3.1 using pip:
pip install -U pytestUse pytest normally, now with:
Fixture functions correctly handling
selfin class-based tests.Stable test runs on FreeBSD without hanging pexpect tests.
Enhanced help when listing markers with
pytest --markers.
Refer to http://pytest.org/ for detailed usage and documentation.
This documentation provides a comprehensive understanding of the [release-2.3.1.rst](/projects/286/66986) file’s purpose, contents, and the context of its updates in the pytest project.