release-2.1.1.rst
Overview
This file is the release notes for **pytest version 2.1.1**, a maintenance update to the popular Python testing tool `py.test`. It documents key fixes, improvements, and new features introduced since the previous release (2.1.0). The primary focus of this release is on resolving issues related to assertion rewriting and enhancing `junitxml` output for better integration with CI tools like Jenkins.
The release notes serve as a changelog and installation guide for users and maintainers, providing a concise summary of bug fixes, improvements, and instructions for upgrading pytest.
Detailed Explanation
Release Purpose and Context
pytest 2.1.1 is a **backward-compatible** patch release aimed at:
Fixing bugs reported after the 2.1.0 release, especially around the core feature of assertion rewriting.
Improving the XML output format used by Jenkins and other CI systems for better display of test tracebacks.
Adding developer and maintainer conveniences such as the ability to generate a
pytestman page.
Key Fixes and Features
The release notes list the following important fixes and features:
Issue/Feature | Description |
|---|---|
**Issue 64:** `pytest.set_trace` support | `pytest.set_trace` now correctly works within `pytest_generate_tests` hooks, facilitating debugging in parametrized tests. |
**Issue 60:** `__pycache__` creation errors | Fixes errors occurring when pytest tries to create `__pycache__` directories, improving stability especially on restricted filesystems. |
**Issue 63:** Assertion rewriting with `%` strings | Corrects assertion rewriting on code involving string formatting placeholders, fixing false positives or errors during test runs. |
Assertion rewriting with `**` arguments | Fixes crashes or incorrect assertions when test code uses function calls with [**kwargs](/projects/286/67223) unpacking. |
Bytecode cache behavior | Prevents caching rewritten modules if bytecode generation is disabled, ensuring consistency in environments where [.pyc](/projects/286/67331) files are not created. |
Assertion rewriting in read-only directories | Fixes issues when tests are run from read-only directories, allowing assertion rewriting without write permissions. |
**Issue 59:** `system-out` and `system-err` tags in `junitxml` | Enhances JUnit XML output by adding `system-out` and `system-err` tags, improving tracebacks display in Jenkins and other CI systems. |
**Issue 61:** Assertion rewriting on boolean operations | Fixes assertion rewriting bugs involving boolean expressions with three or more operands (e.g., `a and b and c`). |
Manual page generation | Adds support for generating a `pytest` man page using `make man` in the [doc/](/projects/286/67225) directory, aiding package maintainers and users. |
Installation Instructions
Users can upgrade to pytest 2.1.1 via pip or easy_install:
pip install -U pytest
# or
easy_install -U pytest
Important Implementation Details
Assertion Rewriting:
pytest’s assertion rewriting is a core feature that transforms test assertion statements into richer error messages. Many fixes in this release address edge cases in the rewriting logic, including handling complex boolean expressions, string formatting placeholders, and keyword argument unpacking.JUnit XML Output Enhancements:
By adding thesystem-outandsystem-errXML tags, pytest improves compatibility with CI tools like Jenkins, which parse these tags to display test outputs and errors cleanly.Filesystem and Caching Improvements:
Fixes around__pycache__creation and bytecode caching ensure pytest behaves correctly even under restrictive environments, such as read-only directories or when bytecode generation is disabled.
Interactions with Other System Components
CI/CD Pipelines:
The improvedjunitxmloutput directly impacts continuous integration systems (e.g., Jenkins), enabling better visualization of test failures and logs.Test Hooks and Plugins:
Fixes topytest.set_tracewithinpytest_generate_testshooks improve plugin and test framework hook integrations, supporting complex parametrized test scenarios.Documentation and Packaging:
The addition of a man page generation target supports better packaging and distribution, especially for Linux distributions and system administrators.
Usage Examples
No code or classes are defined in this file as it is purely a release note. However, example commands provided for installation:
pip install -U pytest
and for documentation generation:
cd doc
make man
Mermaid Diagram: File Structure and Content Flow
Since this file is a textual changelog and release note without classes or functions, a **flowchart** is appropriate to represent the logical structure and content flow of the release notes:
flowchart TD
A[Release Notes for pytest 2.1.1] --> B[Overview]
A --> C[Bug Fixes & Improvements]
C --> C1[Assertion Rewriting Fixes]
C --> C2[junitxml Output Enhancements]
C --> C3[Filesystem & Caching Fixes]
C --> C4[Man Page Generation]
A --> D[Installation Instructions]
A --> E[Interactions with CI & Plugins]
A --> F[Additional Notes]
Summary
The [release-2.1.1.rst](/projects/286/66986) file communicates essential information about the pytest 2.1.1 release, focusing on bug fixes, enhancements, and instructions for users and maintainers. It improves the quality and reliability of pytest's assertion rewriting and XML reporting, thereby enhancing the testing experience and CI integration capabilities. The file is a critical resource for developers upgrading pytest or maintaining test environments that rely on its features.
**End of documentation for release-2.1.1.rst**