Simon Willison 12/5/2025

TIL: Subtests in pytest 9.0.0+

Read Original

This article discusses the introduction of subtests in pytest 9.0.0, a feature allowing programmatic test creation within a single test function. It compares subtests to the traditional pytest.mark.parametrize decorator, highlighting advantages like potential speed improvements and the ability to run setup code before each subtest.

TIL: Subtests in pytest 9.0.0+

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

1
The Beautiful Web
Jens Oliver Meiert 2 votes
3
LLM Use in the Python Source Code
Miguel Grinberg 1 votes
4
Wagon’s algorithm in Python
John D. Cook 1 votes