release-2.2.4.rst
Overview
This file is the release note for **pytest version 2.2.4**, a minor backward-compatible update to the `pytest` testing framework. It provides a concise summary of the release's purpose, highlighting bug fixes, enhancements to junitxml reporting, improved compatibility with Python 3 and unittest, and other minor refinements.
The document serves as a communication artifact primarily for users and contributors of `pytest`, detailing what has changed since version 2.2.3 and how to install or upgrade to this version.
Key aspects of this release:
Fixes in assertion rewriting error messages.
Improved handling of invalid XML characters in junitxml output.
Enhanced compatibility with unittest's
@expectedFailure.Documentation updates regarding integration with setuptools/distribute test commands.
Correct handling of classmethods in setup/teardown.
Migration of pastebin service URL.
Improved lifecycle hooks consistency (
configure/sessionstartandunconfigure/sessionfinish).Better mangling of test IDs for junitxml classnames.
Upgrade of the bundled
distribute_setup.pyscript.
Detailed Content Breakdown
Installation Instructions
This section provides simple commands to install or upgrade `pytest` to version 2.2.4:
pip install -U pytest
# or
easy_install -U pytest
These commands ensure the user has the latest release with all the fixes and improvements.
Contributors and Acknowledgments
The release notes credit the main contributors to this version:
Ronny Pfannschmidt
Benjamin Peterson
Other issue contributors
This helps users and developers appreciate the collaborative nature of the project.
Change Log (From 2.2.3 to 2.2.4)
Each bullet point describes a specific fix or improvement with a brief explanation:
Assertion Rewriting Fix: Corrects error messages involving the
%operator in rewritten assertions.Issue 126: Fixes junitxml reporting by matching all invalid XML characters using binary escapes, ensuring valid XML output.
Unittest Compatibility: Adjusts processing of
@unittest.expectedFailuremarkers; supports@pytest.markmarkers as well.Documentation: Adds information about integration with
distribute/setuptoolstest commands.Issue 140: Correctly retrieves real functions of bound classmethods used in
setup_classandteardown_class.Issue 141: Replaces deprecated pastebin service URL (
paste.pocoo.org) withbpaste.net.Issue 143: Ensures
unconfigureandsessionfinishhooks are always called when correspondingconfigureandsessionstarthooks are invoked.Issue 144: Improves mangling of test IDs for junitxml classname generation.
Upgrade: Bundled
distribute_setup.pyupdated to version 0.6.27.
Implementation Details and Algorithms
The file itself is a textual release note and does not contain executable code, classes, or functions. However, it references important implementation improvements in the pytest codebase, such as:
Assertion rewriting: The fix implies changes in the assertion introspection and rewriting mechanism to handle
%operator error messages properly.junitxml reporting: Fixes involve sanitizing test IDs and escaping invalid XML characters to produce valid junit-compatible XML reports.
Unittest compatibility: Adjustments to marker processing indicate integration improvements between pytest and Python’s standard unittest framework.
Lifecycle hooks: Ensuring paired lifecycle methods (
configure/unconfigure,sessionstart/sessionfinish) are consistently called reflects improved resource management and plugin lifecycle handling.
Interaction with the System
This release note corresponds to the
pytesttesting framework—a widely used Python testing tool.The changes documented affect pytest’s core functionality, reporting output, compatibility with standard library unittest, and integration with Python 3.
It informs users, maintainers, and integrators about the upgrade path and fixes to expect.
The release note indirectly interacts with:
The pytest codebase (source code files handling assertions, junitxml output, and test discovery).
External tools like
pip,easy_install, and setuptools/distribute.External services such as bpaste.net (used for pasting error logs).
Usage Examples
Since this is a release note, it does not include code usage examples. However, typical usage in the context of this release would be:
# Upgrade pytest to version 2.2.4
pip install -U pytest
# Run tests with improved junitxml reporting and Python 3 compatibility
pytest --junitxml=report.xml
Visual Diagram
The diagram below illustrates the **structure of the release note content**, showing the main sections and how they relate to the overall purpose of the file.
flowchart TD
A[release-2.2.4.rst] --> B[Overview]
A --> C[Installation Instructions]
A --> D[Contributors and Acknowledgments]
A --> E[Change Log]
E --> E1[Assertion Rewriting Fix]
E --> E2[junitxml Fixes]
E --> E3[Unittest Compatibility]
E --> E4[Documentation Update]
E --> E5[Classmethod Handling Fix]
E --> E6[Pastebin URL Update]
E --> E7[Lifecycle Hooks Fix]
E --> E8[Test ID Mangling Fix]
E --> E9[Distribute Setup Upgrade]
Summary
This release note file provides all relevant information for users and developers about the minor but important pytest 2.2.4 release. It clarifies the purpose of the update, installation steps, contributors, and detailed fixes. While it does not contain executable code, it documents crucial improvements that enhance pytest’s reliability, compatibility, and usability.
Users upgrading from pytest 2.2.3 will benefit from better error reporting, more robust junitxml output, and improved integration with unittest and Python 3, ensuring smoother test workflows.