release-2.3.3.rst
Overview
This file contains the release notes for **pytest version 2.3.3**, a stabilization update of the popular Python testing tool *py.test*. The document highlights the purpose of the release, enumerates key fixes and improvements, credits contributors, and provides installation instructions. It serves as a historical snapshot and a reference for users upgrading from earlier versions.
The primary focus of version 2.3.3 is improving integration with popular libraries and frameworks (Flask, NumPy, Nose, unittest, mock), restoring compatibility with Python 2.4, and enhancing traceback readability by showing `*` and `**` argument values.
Detailed Content Description
Purpose and Functionality
pytest is a Python testing framework that simplifies writing small tests, scales to support complex functional testing, and offers deep customization.
Version 2.3.3 mainly stabilizes the tool by fixing integration issues, restoring legacy Python support, and improving error reporting.
It targets developers who rely on pytest for automated testing, especially those using third-party libraries or older Python versions.
Key Improvements and Fixes
Integration Fixes:
Resolves issues with Flask’s request object, preventing attribute errors during test collection.
Supports parameterization with non-
__eq__supporting values like NumPy arrays.Enhances Nose test runner support by ensuring setup is callable before invocation.
Improves unittest integration by recognizing @unittest.skip on classes and avoiding unnecessary
setUpClass/tearDownClasscalls.Adds support for
mock.patchfixtures with both the externalmockpackage and Python 3.3+ built-inunittest.mock.
Python 2.4 Support:
Reintroduces compatibility by depending on an updated
pylibthat supports statement-finding on pre-AST interpreters, allowing pytest to run on Python 2.4 again.
Traceback Enhancements:
Shows values of
*argsand**kwargsin tracebacks, aiding debugging by displaying the actual argument values passed to functions.
Documentation and Usability:
Improves documentation for
pytest_addoption().Adds a helper config.getoption(name) for consistent option retrieval.
Contributors
Acknowledges major contributors for patches and issue fixes, specifically Manuel Jacob, Thomas Waldmann, Ronny Pfannschmidt, Pavel Repin, and Andreas Taumoefolau.
Installation Instructions
pip install -U pytest
# or
easy_install -U pytest
Usage Example
While no explicit code examples are provided in the release note, typical usage of pytest after installation is:
pytest tests/
Where `tests/` is the directory containing test modules.
Implementation Details & Algorithms
The release mainly involves bug fixes and integration improvements rather than new algorithms.
The patch for Flask’s
requestobject issue involves safely accessing attributes to avoid exceptions when no request context is active.Support for parametrization with NumPy arrays likely involves enhanced equality or identity checks that do not rely solely on
__eq__.Python 2.4 support is restored by depending on a newer version of
pylibwhich improves statement-finding—important for test discovery in older Python interpreters without AST support.Traceback improvements incorporate introspection of
*argsand**kwargsto display their contents alongside regular arguments, enhancing debug output clarity.
Interactions with Other System Components
Integration with Third-Party Libraries: The fixes improve pytest’s compatibility with Flask, NumPy, Nose, unittest, and mock libraries, which are commonly used in testing scenarios.
Python Versions: By supporting Python 2.4 through 3.3+, pytest maintains a wide range of compatibility, enabling users with legacy environments to adopt the tool.
Test Discovery and Execution: The fixes to statement-finding and safe object attribute access directly impact pytest’s ability to discover and run tests reliably.
Fixtures and Mocking: Improved support for
mock.patchfixtures enhances pytest’s fixture system and allows seamless mocking in tests.User Configuration: Added helper functions (
config.getoption) improve user interaction with pytest’s configuration API.
Mermaid Class Diagram
This file is a release notes document and does not define classes or functions. However, to visualize the structure of the release notes content and its key areas, a flowchart representation can be used instead.
flowchart TD
A[Release Notes: pytest-2.3.3] --> B[Overview]
A --> C[Key Improvements]
A --> D[Contributors]
A --> E[Installation Instructions]
A --> F[Implementation Details]
A --> G[Interactions with Other Components]
C --> C1[Integration Fixes]
C --> C2[Python 2.4 Support]
C --> C3[Traceback Enhancements]
C --> C4[Documentation Improvements]
Summary
The [release-2.3.3.rst](/projects/286/66986) file documents the pytest 2.3.3 release, emphasizing stabilization through multiple integration fixes, legacy Python support, and usability enhancements. It is an essential reference for users upgrading pytest or troubleshooting test suite issues related to these areas. The document helps communicate changes clearly to the user community, ensuring smooth transitions between versions and better testing experiences.
For more information, users are directed to the official pytest website: [http://pytest.org/](http://pytest.org/)