release-2.0.1.rst
Overview
This file is the official release notes document for **pytest version 2.0.1**, a maintenance and bug fix update of the popular Python testing framework **pytest**. It provides a concise summary of the changes, bug fixes, improvements, and new features introduced since the previous version (2.0.0). The document also includes installation instructions, acknowledgments, and pointers to the official documentation.
`pytest` is a mature testing tool for Python that supports multiple interpreters, including CPython 2.4-3.2, Jython, and PyPy. It simplifies writing and running tests, offering powerful features such as fixtures, parameterized tests, and rich assertion introspection.
Detailed Contents
File Purpose and Functionality
Communicate the nature of the update (maintenance and bug fixes).
Summarize specific issues fixed and enhancements made in version 2.0.1.
Provide installation and upgrade commands.
Acknowledge contributors and community members.
Serve as an official changelog for pytest users and developers.
This file is typically distributed alongside the pytest software release and may be included in documentation packages and version control repositories.
Sections Breakdown
1. Header and Introduction
Announces the version: py.test 2.0.1: bug fixes
Brief welcome paragraph describing pytest's maturity and broad interpreter support.
Link to official documentation for further reading: http://pytest.org/
Installation commands using
pipandeasy_install.
Usage example for upgrading pytest:
pip install -U pytest
# or
easy_install -U pytest
2. Acknowledgments
Thanks contributors and issue reporters.
Highlights key contributors who made coding contributions for this release.
3. Changes Between Versions 2.0.0 and 2.0.1
A detailed list of fixes and improvements, including:
Capturing refinement: Improved initial capturing mechanism for compatibility with early-loaded
conftest.pyfiles and plugins that use the logging module.Plugin version reporting: Fixed plugin version display with
--versionand--traceconfig, plus documentation enhancements.Python 3 compatibility: Fixed import reporting issues and nose compatibility tests.
Assertion improvements: Refined assertion interpretation for numpy arrays and "not in" expressions.
Regression fixes: Restored command-line argument setting from
conftest.pyvia a new hookpytest_cmdline_processargs(args).Test result reporting: Fixed handling of setup/teardown with xfail-marked tests and doctest assertion failures.
Plugin management: Introduced command-line unregistering of plugins and activated the
resultlogplugin by default.Yielded tests regression: Fixed setup behavior for yielded tests aligning with older pytest versions.
These detailed bullet points help users and developers understand what issues have been addressed and how the framework's behavior has evolved.
Implementation Details and Algorithms
While this file itself is a static changelog and does not contain executable code or algorithms, it refers to important internal pytest mechanisms affected by the fixes:
Capturing subsystem: The capturing system in pytest intercepts stdout/stderr and logging output during test runs. Refining capturing ensures that output from early imports or plugins is correctly managed.
Hook system: Introduction of
pytest_cmdline_processargs(args)hook enables dynamic command-line argument processing, restoring flexibility that was lost in pytest 2.0.Assertion rewriting: Improvements in how assertions are interpreted, especially for complex objects like numpy arrays, provide more accurate test failure reporting.
Plugin management: New mechanisms for plugin registration and unregistration at runtime via command line enhance extensibility and control.
This document is a window into the ongoing maintenance and enhancement efforts behind pytest, reflecting a careful balance between backward compatibility and new features.
Interactions with Other Parts of the System
Conftest.py files: The capturing fix and command-line argument hook impact how
conftest.pyfiles can influence test runs, especially early-loaded ones.Plugins: Changes to plugin version reporting, registration, and unregistration affect pytest’s plugin management subsystem.
Test collection and execution: Fixes related to yielded tests, test setup/teardown, and doctests impact the test collection and execution workflow.
Command-line interface: New hooks and reporting improvements affect how pytest processes command-line options and displays output.
Resultlog plugin: Activation by default integrates logging of test results into the core workflow.
Usage Examples
Though the file is a changelog, users benefit by following the installation instructions or upgrading pytest to access the fixes:
pip install -U pytest
To display pytest and plugin versions:
pytest --version
To trace configuration, including plugins:
pytest --traceconfig
Visual Diagram
Below is a **class diagram** representing the key conceptual components and hooks described or implied in the changelog. Since this file does not define explicit classes, the diagram models core pytest subsystems and hooks related to the fixes:
classDiagram
class PytestCore {
+run_tests()
+collect_tests()
+process_command_line(args)
}
class Capturing {
+start()
+stop()
+refine_initial_capturing()
}
class PluginManager {
+register_plugin(plugin)
+unregister_plugin(plugin)
+list_plugins()
+show_versions()
}
class Hooks {
+pytest_cmdline_processargs(args)
+pytest_collection_modifyitems(items)
}
class TestSetupTeardown {
+setup()
+teardown()
+handle_xfail()
}
PytestCore --> Capturing : manages
PytestCore --> PluginManager : manages
PytestCore --> Hooks : uses
PytestCore --> TestSetupTeardown : coordinates
PluginManager --> Hooks : registers hooks
Summary
This release notes file for **pytest 2.0.1** is an essential resource for users and developers to understand the scope and nature of bug fixes and improvements in this maintenance update. It documents important changes in capturing, plugin management, assertion handling, and test execution workflows. By following the installation instructions and consulting this changelog, users can confidently upgrade pytest and leverage the enhanced stability and functionality it offers.
*End of documentation for release-2.0.1.rst*