diff --git a/crates/red_knot_test/Cargo.toml b/crates/red_knot_test/Cargo.toml index bdc9e4738cf235..4f974b5a525494 100644 --- a/crates/red_knot_test/Cargo.toml +++ b/crates/red_knot_test/Cargo.toml @@ -13,7 +13,7 @@ license.workspace = true [dependencies] red_knot_python_semantic = { workspace = true, features = ["serde"] } red_knot_vendored = { workspace = true } -ruff_db = { workspace = true } +ruff_db = { workspace = true, features = ["testing"] } ruff_index = { workspace = true } ruff_python_trivia = { workspace = true } ruff_source_file = { workspace = true } diff --git a/crates/red_knot_test/README.md b/crates/red_knot_test/README.md index e4e7010d916ae0..9608adab1b1e9a 100644 --- a/crates/red_knot_test/README.md +++ b/crates/red_knot_test/README.md @@ -241,6 +241,8 @@ python-version = "3.10" This configuration will apply to all tests in the same section, and all nested sections within that section. Nested sections can override configurations from their parent sections. +See [`MarkdownTestConfig`](https://github.com/astral-sh/ruff/blob/main/crates/red_knot_test/src/config.rs) for the full list of supported configuration options. + ## Documentation of tests Arbitrary Markdown syntax (including of course normal prose paragraphs) is permitted (and ignored by diff --git a/crates/red_knot_test/src/config.rs b/crates/red_knot_test/src/config.rs index b73cdfacaef2f6..cf677c485c3da4 100644 --- a/crates/red_knot_test/src/config.rs +++ b/crates/red_knot_test/src/config.rs @@ -16,6 +16,7 @@ use serde::Deserialize; #[serde(rename_all = "kebab-case", deny_unknown_fields)] pub(crate) struct MarkdownTestConfig { pub(crate) environment: Option, + pub(crate) log: Option, } @@ -32,12 +33,15 @@ impl MarkdownTestConfig { #[derive(Deserialize, Debug, Default, Clone)] #[serde(rename_all = "kebab-case", deny_unknown_fields)] pub(crate) struct Environment { + /// Python version to assume when resolving types. pub(crate) python_version: Option, } #[derive(Deserialize, Debug, Clone)] #[serde(untagged)] pub(crate) enum Log { + /// Enable logging with tracing when `true`. Bool(bool), + /// Enable logging and only show filters that match the given [env-filter](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html) Filter(String), }