The biggest Python topics of 2023 ›

Python Testing Tools and Techniques

Testing in Python encompasses a wide range of practices and tools, including using pytest for automated testing, property-based testing with tools like Hypothesis, mocking in tests, and testing across multiple Python versions. This diverse topic covers everything from optimizing test performance with pytest fixtures to exploring new libraries like Grasshopper for load testing in Python.

Generating Meaningful Tests for Busy Devs Article

With CodiumAI’s TestGPT, you can ensure that your code works exactly as you meant it to. TestGPT analyzes your code, docstring, comments, and interacts with you to suggest tests while you code. You only need to accept and commit to these tests to ensure the quality of your code →

Don’t Mock Python’s HTTPX Article

HTTPX is a popular alternative to the requests library. James writes how using mock to test it can be problematic, and suggests an alternative approach.

Using pytest to Test PySpark Code Article

This article shows you how to run automated tests on your PySpark code using the pytest. It delves into some of the pitfalls and how to make your tests performant.

Testing With Hypothesis Article

Hypothesis is a property-based testing library. This style of testing uses ranges of scenarios rather than a single value, and then the tool explores the results. See also the intro article to strategy based testing.

Python Testing Tools Taxonomy Article

This entry in the Python wiki is an exhaustive list of testing tools and libraries. Content includes unit testing, mocking, fuzz testing, web testing, coverage tools, and much more.

Pytest Daemon: 10X Local Test Iteration Speed Article

Discord has a large Python monolith with lots of imports, which now takes 13 seconds to start up. On the server that’s not a problem but to run a test it is. Ruby’s solution is to have a daemon that hot loads a test on a process that already has the imports completed.

100% Test Coverage Is Not Enough Article

This post describes why Property-Based Testing is superior to simply achieving 100% code coverage and how it can catch more bugs.

How to Test Jupyter Notebooks With Pytest and Nbmake Article

Tutorial on how to use the pytest plugin nbmake to automate end-to-end testing of notebooks.

pytest Fixtures Are Magic! Article

Fixtures are building blocks for good tests and can increase development speed. The main issue with writing tests is setting up necessary data before the test, but pytest fixtures make it easier by injecting necessary data into your tests.

Introducing Grasshopper: A Python Load Testing Library Article

This article introduces you to Grasshopper, an open source load testing library for Python. It is built on top of Locust and PyTest providing additional ways of checking and timing your tests.

Testing Multiple Python Versions With nox and pyenv Article

Quick instructions on using nox with parameters to test multiple versions of Python against your test suite.

End-to-End Testing With Python and Playwright Article

This post shows you how to get started with Playwright, add end-to-end tests to an existing project, and automate running it using GitHub Actions.

Property-Based Testing With Hypothesis and Pytest Article

This tutorial is a gentle guide to property-based testing. Property-based testing is a testing philosophy; a way of approaching testing that will bring you many benefits that other types of testing don’t give you.

AB Testing 101 Article

A comprehensive deep dive on AB Testing including the math behind knowing whether your tests are significant.

Building a Bloom Filter Article

Bloom filters are a data structure used to test whether an element is a member of a set. They’re commonly used in data science and are often part of interview questions. Learn how to build one and where you might use them.