Python Testing with Pytest: Simple, Rapid, Effective, and Scalable (Paperback)
暫譯: 使用 Pytest 進行 Python 測試:簡單、快速、有效且可擴展
Okken, Brian
- 出版商: Pragmatic Bookshelf
- 出版日期: 2022-03-29
- 售價: $1,980
- 貴賓價: 9.8 折 $1,940
- 語言: 英文
- 頁數: 274
- 裝訂: Quality Paper - also called trade paper
- ISBN: 1680508601
- ISBN-13: 9781680508604
-
相關分類:
Unit Test 單元測試
海外代購書籍(需單獨結帳)
買這商品的人也買了...
-
Python 技術者們 - 練功!老手帶路教你精通正宗 Python 程式 (The Quick Python Book, 3/e)$780$663 -
邁向 Linux 工程師之路:Superuser 一定要懂的技術與運用, 2/e (How Linux Works: What Every Superuser Should Know, 2/e)$600$468 -
矽谷工程師爬蟲手冊:用 Python 成為進階高手$890$703 -
矽谷資深演算法大師:帶你學深度學習推薦系統 (附8頁彩頁)$780$616 -
Effective Python 中文版|寫出良好 Python 程式的 90個具體做法, 2/e (Effective Python: 90 Specific Ways to Write Better Python, 2/e)$580$458 -
Python 從網路爬蟲到生活應用超實務:人工智慧世代必備的資料擷取術$620$465 -
$555MATLAB 2020 GUI 程序設計從入門到精通 -
$400軟件自動化測試實戰解析:基於Python3編程語言 -
Scratch 超人氣遊戲大改造:動腦想、動手玩,讓程式與遊戲設計都變有趣!$490$387 -
Software Architecture: The Hard Parts: Modern Trade-Off Analyses for Distributed Architectures (Paperback)$2,593$2,457 -
Python 出神入化:Clean Coder 才懂的 Pythonic 技法,為你的程式碼畫龍點睛! (Clean Code in Python, 2/e)$720$561 -
pytest 框架與自動化測試應用$600$570 -
A Practical Guide to Verilog-A: Mastering the Modeling Language for Analog Devices, Circuits and Systems (Paperback)$2,250$2,137 -
Fluent Python: Clear, Concise, and Effective Programming, 2/e (Paperback)$2,831$2,682 -
Linux 錦囊妙計|基礎操作x系統與網路管理, 2/e (Linux Cookbook: Essential Skills for Linux Users and System & Network Administrators, 2/e)$780$616 -
FLAG'S 創客‧自造者工作坊 -- 用 ESP32 × Arduino IDE 學 AI 機器 學習$1,599$1,359 -
Python 小專案大集合:提升功力的 81個簡單有趣小程式$720$561 -
ASP.NET Core 工程師不可不知的 10大安全性漏洞與防駭方法$690$483 -
$1,935Testing Web APIs -
ASP.NET Core 6 框架揭秘:跨平台 Web 開發全面解析 (上冊)$820$410 -
ASP.NET Core 6 框架揭秘:跨平台 Web 開發全面解析 (下冊)$860$430 -
FLAG'S 創客‧自造者工作坊 -- 用創客玩 ChatGPT x Python AI 語音大應用$1,599$1,439 -
版本控制使用 Git, 3/e (Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development, 3/e)$880$695 -
Vibe Coding CLI 頂級開發 - Claude Code 前瞻菁英育成手冊$1,080$853 -
AI Agent 手刻首選 - 使用 LangChain 親手實作 LLM 大型商業專案$880$695
商品描述
Test applications, packages, and libraries large and small with pytest, Python's most powerful testing framework. pytest helps you write tests quickly and keep them readable and maintainable. In this fully revised edition, explore pytest's superpowers - simple asserts, fixtures, parametrization, markers, and plugins - while creating simple tests and test suites against a small database application. Using a robust yet simple fixture model, it's just as easy to write small tests with pytest as it is to scale up to complex functional testing. This book shows you how.
pytest is undeniably the best choice for testing Python projects. It's a full-featured, flexible, and extensible testing framework. pytest's fixture model allows you to share test data and setup procedures across multiple layers of tests. The pytest framework gives you powerful features such as assert rewriting, parametrization, markers, plugins, parallel test execution, and clear test failure reporting - 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 yet powerful tool. Write short, maintainable tests that elegantly express what you're testing. Speed up test times by distributing tests across multiple processors and running tests in parallel. Use Python's builtin assert statements instead of awkward assert helper functions to make your tests more readable. Move setup code out of tests and into fixtures to separate setup failures from 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, and even existing unittest tests.
Write simple, maintainable tests quickly with pytest.
What You Need:
The examples in this book were written using Python 3.9 and pytest 6. pytest 6 supports Python 3.5 and above.
商品描述(中文翻譯)
測試應用程式、套件和庫,無論大小,使用 pytest,Python 最強大的測試框架。pytest 幫助您快速編寫測試,並保持其可讀性和可維護性。在這本全面修訂的版本中,探索 pytest 的超能力 - 簡單的斷言、fixture、參數化、標記和插件 - 同時針對一個小型資料庫應用程式創建簡單的測試和測試套件。使用一個穩健而簡單的 fixture 模型,使用 pytest 編寫小型測試和擴展到複雜的功能測試一樣簡單。本書將告訴您如何做到這一點。
pytest 無疑是測試 Python 專案的最佳選擇。它是一個功能齊全、靈活且可擴展的測試框架。pytest 的 fixture 模型允許您在多層測試中共享測試數據和設置程序。pytest 框架提供了強大的功能,如斷言重寫、參數化、標記、插件、並行測試執行和清晰的測試失敗報告 - 無需樣板代碼。
本書提供簡單的逐步指導和範例代碼,讓您快速掌握這個易於學習但功能強大的工具。編寫簡短、可維護的測試,優雅地表達您正在測試的內容。通過在多個處理器上分配測試並並行運行測試來加快測試時間。使用 Python 的內建斷言語句,而不是笨拙的斷言輔助函數,使您的測試更具可讀性。將設置代碼移出測試並放入 fixture 中,以將設置失敗與測試失敗分開。使用預期異常測試來測試錯誤條件和邊界情況,並使用參數化測試來用一個測試運行多個測試案例。通過插件擴展 pytest,將其連接到持續集成系統,並與 tox、mock、coverage 甚至現有的 unittest 測試一起使用。
快速編寫簡單、可維護的測試,使用 pytest。
您需要的內容:
本書中的範例是使用 Python 3.9 和 pytest 6 編寫的。pytest 6 支援 Python 3.5 及以上版本。
作者簡介
Brian Okken is the host of the Test & Code podcast, and co-host of the Python Bytes podcast. He's also a lead software engineer.
作者簡介(中文翻譯)
Brian Okken 是 Test & Code 播客的主持人,也是 Python Bytes 播客的共同主持人。他還是一名首席軟體工程師。