Python Testing with pytest

Python Testing with pytest pdf epub mobi txt 电子书 下载 2025

出版者:The Pragmatic Bookshelf
作者:Brian Okken
出品人:
页数:220
译者:
出版时间:2017-9-13
价格:USD 45.95
装帧:平装
isbn号码:9781680502404
丛书系列:
图书标签:
  • Python
  • Test
  • 编程
  • 计算机
  • pytest
  • Programming
  • pytest
  • Python
  • Testing
  • Unit Testing
  • Integration Testing
  • Test Automation
  • Software Testing
  • Development
  • Programming
  • Debugging
想要找书就要到 小美书屋
立刻按 ctrl+D收藏本页
你会得到大惊喜!!

具体描述

For Python-based projects, pytest is the undeniable choice to test your code if you’re looking for a full-featured, API-independent, flexible, and extensible testing framework. With a full-bodied fixture model that is unmatched in any other tool, the pytest framework gives you powerful features such as assert rewriting and plug-in capability—with no boilerplate code.

With simple step-by-step instructions and sample code, this book gets you up to speed quickly on this easy-to-learn and robust tool. Write short, maintainable tests that elegantly express what you’re testing. Add powerful testing features and still speed up test times by distributing tests across multiple processors and running tests in parallel. Use the built-in assert statements to reduce false test failures by separating setup and test failures. Test error conditions and corner cases with expected exception testing, and use one test to run many test cases with parameterized testing. Extend pytest with plugins, connect it to continuous integration systems, and use it in tandem with tox, mock, coverage, unittest, and doctest.

Write simple, maintainable tests that elegantly express what you’re testing and why.

作者简介

Brian Okken is a lead software engineer with two decades of R&D experience developing test and measurement instruments. He hosts the Test & Code podcast and co-hosts the Python Bytes podcast.

目录信息

Acknowledgments
Preface
What Is pytest?
Learn pytest While Testing an Example Application
How This Book Is Organized
What You Need to Know
Example Code and Online Resources
Getting Started with pytest
Getting pytest
Running pytest
Running Only One Test
Using Options
Exercises
What’s Next
Writing Test Functions
Testing a Package
Using assert Statements
Expecting Exceptions
Marking Test Functions
Skipping Tests
Marking Tests as Expecting to Fail
Running a Subset of Tests
Parametrized Testing
Exercises
What’s Next
pytest Fixtures excerpt
Sharing Fixtures Through conftest.py
Using Fixtures for Setup and Teardown
Tracing Fixture Execution with –setup-show
Using Fixtures for Test Data
Using Multiple Fixtures
Specifying Fixture Scope
Specifying Fixtures with usefixtures
Using autouse for Fixtures That Always Get Used
Renaming Fixtures
Parametrizing Fixtures
Exercises
What’s Next
Builtin Fixtures
Using tmpdir and tmpdir_factory
Using pytestconfig
Using cache
Using capsys
Using monkeypatch
Using doctest_namespace
Using recwarn
Exercises
What’s Next
Plugins
Finding Plugins
Installing Plugins
Writing Your Own Plugins
Creating an Installable Plugin
Testing Plugins excerpt
Creating a Distribution
Exercises
What’s Next
Configuration
Understanding pytest Configuration Files
Changing the Default Command-Line Options
Registering Markers to Avoid Marker Typos
Requiring a Minimum pytest Version
Stopping pytest from Looking in the Wrong Places
Specifying Test Directory Locations
Changing Test Discovery Rules
Disallowing XPASS
Avoiding Filename Collisions
Exercises
What’s Next
Using pytest with Other Tools
pdb: Debugging Test Failures
Coverage.py: Determining How Much Code Is Tested
mock: Swapping Out Part of the System
tox: Testing Multiple Configurations
Jenkins CI: Automating Your Automated Tests
unittest: Running Legacy Tests with pytest
Exercises
What’s Next
Virtual Environments
pip
Plugin Sampler Pack
Plugins That Change the Normal Test Run Flow
Plugins That Alter or Enhance Output
Plugins for Static Analysis
Plugins for Web Development
Packaging and Distributing Python Projects
Creating an Installable Module
Creating an Installable Package
Creating a Source Distribution and Wheel
Creating a PyPI-Installable Package
xUnit Fixtures
Syntax of xUnit Fixtures
Mixing pytest Fixtures and xUnit Fixtures
Limitations of xUnit Fixtures
· · · · · · (收起)

读后感

评分

我在网上发现这本书后立即有了兴趣,机缘巧合之下找到了pdf版(抱歉实在付不起西方国家的书价)。 本书勾起了我的两个情怀,一是它出版自pragmatic bookshelf出版社,我对这个出版社的映像很好。原因是看过它们老板的访谈文章,并且觉得它们出版书籍的封面很好看。 第二个情怀是p...

评分

我在网上发现这本书后立即有了兴趣,机缘巧合之下找到了pdf版(抱歉实在付不起西方国家的书价)。 本书勾起了我的两个情怀,一是它出版自pragmatic bookshelf出版社,我对这个出版社的映像很好。原因是看过它们老板的访谈文章,并且觉得它们出版书籍的封面很好看。 第二个情怀是p...

评分

我在网上发现这本书后立即有了兴趣,机缘巧合之下找到了pdf版(抱歉实在付不起西方国家的书价)。 本书勾起了我的两个情怀,一是它出版自pragmatic bookshelf出版社,我对这个出版社的映像很好。原因是看过它们老板的访谈文章,并且觉得它们出版书籍的封面很好看。 第二个情怀是p...

评分

我在网上发现这本书后立即有了兴趣,机缘巧合之下找到了pdf版(抱歉实在付不起西方国家的书价)。 本书勾起了我的两个情怀,一是它出版自pragmatic bookshelf出版社,我对这个出版社的映像很好。原因是看过它们老板的访谈文章,并且觉得它们出版书籍的封面很好看。 第二个情怀是p...

评分

我在网上发现这本书后立即有了兴趣,机缘巧合之下找到了pdf版(抱歉实在付不起西方国家的书价)。 本书勾起了我的两个情怀,一是它出版自pragmatic bookshelf出版社,我对这个出版社的映像很好。原因是看过它们老板的访谈文章,并且觉得它们出版书籍的封面很好看。 第二个情怀是p...

用户评价

评分

主要看了下fixture

评分

主要看了下fixture

评分

主要看了下fixture

评分

不推荐,还是官方文档好些

评分

主要看了下fixture

本站所有内容均为互联网搜索引擎提供的公开搜索信息,本站不存储任何数据与内容,任何内容与数据均与本站无关,如有需要请联系相关搜索引擎包括但不限于百度google,bing,sogou

© 2025 book.quotespace.org All Rights Reserved. 小美书屋 版权所有