|
|
Log in / Subscribe / Register

Pytest 9.0.0 released

Version 9.0.0 of pytest has been released. Notable changes in this release include the addition of subtests, native support for TOML configuration files, and a new strict mode. See the changelog for a complete list of new features, enhancements, and bug fixes.



to post comments

Subtests

Posted Nov 10, 2025 21:52 UTC (Mon) by Lord_Gaav (subscriber, #178078) [Link] (1 responses)

Subtests are working great, good alternative voor parametrize.

Subtests

Posted Nov 11, 2025 9:48 UTC (Tue) by fishface60 (subscriber, #88700) [Link]

I think treating subtests as just an alternative to parametrization is underselling them.

It's not uncommon to have a relatively slow operation produce a result that has multiple values to check e.g. it produces a json document that needs to have multiple fields validated.

If you were to use parametrization or a bunch of other test functions for this you would need a common fixture, which makes it ambiguous where the failure is since all those tests share the fixture, and if you need to parametrize the fixure that adds yet more complexity.

Instead you can save the complexity of parameters for what you're passing to the function you're testing by putting your assertions within subtests so they don't terminate the test and you can test all of the properties instead of stopping at the first error.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds