Testing in Python
This book is 99% complete
Last updated on 2020-02-22
About the Book
Getting started with testing can be hard, and this book aims make it all very easy by using examples and explaining the process in a straightforward way. Testing is a core principle of robust software implementations and should be a prime skill to master that can be applied to any project.
Alfredo Deza is a passionate software engineer, avid open source developer, Vim plugin author, photographer, and former Olympic athlete. He has given several lectures around the world about Open Source Software, personal development, and professional sports. He has rebuilt company infrastructure, designed shared storage, and replaced complex build systems, always in search of efficient and resilient environments. With a strong belief in testing and documentation, he continues to drive robust development practices wherever he is.
As a spirited knowledge-craving developer Alfredo can be found giving presentations in local groups about Python, file systems and storage, system administration, and professional sports.
- Why test at all?
- Leveling up from simple scripts to robust implementations
- Python, Pytest, Tox supported versions in this book
- About the cover
Chapter 1: Configuring the environment
- Setting up and using Git
- Setting up and using Virtualenv
- Installing packages and dependencies
- Setup Visual Code code
- Setup and use Vim
- Setup Makefile
- Setup and Use ZSH/Bash
- Using Cloud-based development environments
Chapter 2: Testing Conventions
- Functions, Classes, and test methods
- Special test class methods
- Good naming patterns
Chapter Three: Introduction to Pytest
- The most simple test possible
- Why is Pytest important?
The power of
- Pytest vs. Unittest
Chapter 4: Test Classes
- Setting up and teardown of xunit-style tests
Chapter 5: Reporting
- PyTest Reporting
- Code Quality
- Code Formatting with Python Black
Chapter 6: Debugging with Pytest
- How to debug code
- Using a debugger
- Python Debugger (PDB) integration
Chapter 7: Pytest fixtures and plugins
- What are fixtures?
- Creating new fixtures
- Built-in Fixtures
- Advanced Fixture usage
Chapter 8: Monkeypatching
- Why and when to monkeypatch?
- monkeypatching is hard
- The simplest monkeypatching
- Automatic and global monkeypatching
- Other patching
- When not to monkeypatch
Chapter 9: Testing matrix with Tox
- Testing different Python versions
- Expanding the testing matrix
- Linting and other validations
Chapter 10: Continuous Integration and Continuous Delivery
- What is Continuous Integration and Continuous Delivery and Why Do They Matter?
- GCP Cloud Build
- Continuous Delivery for Hugo Static Site from Zero using AWS Code Pipeline
- Github Actions
Chapter 11: Case Studies and War Stories
- Testing Click Commandline Tools
- War Story: The Health Check that wasn’t wrong
- War Story: The Nine Circles of Hell While Parsing XML
- War Story: The Mysterious Vanishing Servers
Chapter 12: Essays
- Writing clean, testable, high quality code in Python
- Increase reliability in data science and machine learning projects with CircleCI
- Data science project quality
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.