mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 05:20:49 -05:00
## Summary This adds support for specifying the target Python version from a Markdown test. It is a somewhat limited ad-hoc solution, but designed to be future-compatible. TOML blocks can be added to arbitrary sections in the Markdown block. They have the following format: ````markdown ```toml [tool.knot.environment] target-version = "3.13" ``` ```` So far, there is nothing else that can be configured, but it should be straightforward to extend this to things like a custom typeshed path. This is in preparation for the statically-known branches feature where we are going to have to specify the target version for lots of tests. ## Test Plan - New Markdown test that fails without the explicitly specified `target-version`. - Manually tested various error paths when specifying a wrong `target-version` field. - Made sure that running tests is as fast as before.