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