Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
pytest documentation
Logo
  • 開始使用
  • 操作指南
    • How to invoke pytest
    • How to write and report assertions in tests
    • How to use fixtures
    • How to mark test functions with attributes
    • How to parametrize fixtures and test functions
    • How to use subtests
    • How to use temporary directories and files in tests
    • How to monkeypatch/mock modules and environments
    • How to run doctests
    • How to re-run failed tests and maintain state between test runs
    • How to handle test failures
    • Managing pytest's output
    • How to manage logging
    • How to capture stdout/stderr output
    • How to capture warnings
    • How to use skip and xfail to deal with tests that cannot succeed
    • How to install and use plugins
    • Writing plugins
    • Writing hook functions
    • How to use pytest with an existing test suite
    • How to use unittest-based tests with pytest
    • How to implement xunit-style set-up
    • How to set up bash completion
  • 參考指南
    • API 參考
    • 夾具參考
    • 組態
    • 退出碼
    • Pytest Plugin List
  • Explanation
    • Anatomy of a test
    • About fixtures
    • Good Integration Practices
    • pytest import mechanisms and sys.path/PYTHONPATH
    • Typing in pytest
    • CI Pipelines
    • Flaky tests
  • Examples and customization tricks
    • Demo of Python failure reports with pytest
    • Basic patterns and examples
    • Parametrizing tests
    • Working with custom markers
    • A session-fixture which can look at all collected tests
    • Changing standard (Python) test discovery
    • Working with non-python tests
    • Using a custom directory collector

關於此專案

  • 變更日誌
  • 參與貢獻
  • 向後相容性方針
  • History
  • Python 版本支援
  • 贊助者
  • pytest for enterprise
  • 授權條款
  • 聯絡通道

Useful links

  • pytest @ PyPI
  • pytest @ GitHub
  • 議題追蹤器
  • PDF 文件
Back to top
Copyright © 2015, holger krekel and pytest-dev team
Made with Sphinx and @pradyunsg's Furo