Full pytest documentation¶
Download latest version as PDF
- Installation and Getting Started
- Usage and Invocations
- Calling pytest through
python -m pytest - Possible exit codes
- Getting help on version, option names, environment variables
- Stopping after the first (or N) failures
- Specifying tests / selecting tests
- Modifying Python traceback printing
- Detailed summary report
- Dropping to PDB (Python Debugger) on failures
- Dropping to PDB (Python Debugger) at the start of a test
- Setting breakpoints
- Using the builtin breakpoint function
- Profiling test execution duration
- Fault Handler
- Creating JUnitXML format files
- Creating resultlog format files
- Sending test report to online pastebin service
- Early loading plugins
- Disabling plugins
- Calling pytest from Python code
- Calling pytest through
- Using pytest with an existing test suite
- The writing and reporting of assertions in tests
- pytest fixtures: 显式,模块化,可扩展
- 使用属性标记测试函数
- Monkeypatching/mocking模块和环境
- Temporary directories and files
- Capturing of the stdout/stderr output
- Warnings Capture
- Doctest integration for modules and test files
- Skip and xfail: dealing with tests that cannot succeed
- Parametrizing fixtures and test functions
- Cache: working with cross-testrun state
- unittest.TestCase Support
- Running tests written for nose
- classic xunit-style setup
- Installing and Using plugins
- Writing plugins
- Plugin discovery order at tool startup
- conftest.py: local per-directory plugins
- Writing your own plugin
- Making your plugin installable by others
- Assertion Rewriting
- Requiring/Loading plugins in a test module or conftest file
- Accessing another plugin by name
- Registering custom markers
- Testing plugins
- Writing hook functions
- Logging
- API Reference
- Good Integration Practices
- Flaky tests
- pytest import mechanisms and
sys.path/PYTHONPATH - Configuration
- Examples and customization tricks
- Setting up bash completion
- Backwards Compatibility Policy
- Deprecations and Removals
- Python 2.7 and 3.4 support plan
- Historical Notes
- Marker revamp and iteration
- cache plugin integrated into the core
- funcargs and
pytest_funcarg__ @pytest.yield_fixturedecorator[pytest]header insetup.cfg- Applying marks to
@pytest.mark.parametrizeparameters @pytest.mark.parametrizeargument names as a tuple- setup: is now an “autouse fixture”
- Conditions as strings instead of booleans
pytest.set_trace()- “compat” properties
- License
- Development Guide
- Talks and Tutorials
- Project examples
- Some Issues and Questions
- Contact channels
- Sponsor