导航

  • 模块
  • pytest-7.1 »
  • 学习指南

学习指南¶

pytest 核心功能¶

  • 如何调用 pytest
  • 如何编写和报告测试中的断言
  • 如何使用 fixtures
  • 如何用属性标记测试函数
  • 如何参数化 fixtures 和测试函数
  • 如何在测试中使用临时目录和文件
  • How to monkeypatch/mock modules and environments
  • How to run doctests
  • 如何重新运行失败的测试并在测试运行之间保持状态

测试输出和结果¶

  • How to handle test failures
  • 管理 pytest 的输出
  • 如何管理日志记录
  • How to capture stdout/stderr output
  • How to capture warnings
  • How to use skip and xfail to deal with tests that cannot succeed

插件¶

  • 如何安装并使用插件
  • Writing plugins
  • Writing hook functions

pytest 和其他测试系统¶

  • How to use pytest with an existing test suite
  • How to use unittest-based tests with pytest
  • How to run tests written for nose
  • How to implement xunit-style set-up

pytest开发环境¶

  • 如何设置 bash 自动补全

Logo

Contents

  • Home
  • Get started
  • How-to guides
  • Reference guides
  • Explanation
  • Complete table of contents
  • Library of examples

About the project

  • Changelog
  • Contributing
  • Backwards Compatibility
  • Sponsor
  • pytest for Enterprise
  • License
  • Contact Channels

  • 学习指南
    • pytest 核心功能
    • 测试输出和结果
    • 插件
    • pytest 和其他测试系统
    • pytest开发环境

Related Topics

  • Documentation overview

Useful Links

  • pytest @ PyPI
  • pytest @ GitHub
  • Issue Tracker
  • PDF Documentation
© 版权所有 2015, holger krekel and pytest-dev team. 由 Sphinx 5.2.3创建。