mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 22:01:18 +00:00
Auto-generate environment variable references for ty (#19205)
## Summary
This PR mirrors the environment variable implementation we have in uv:
efc361223c/crates/uv-static/src/env_vars.rs (L6-L7)
.
See: https://github.com/astral-sh/ty/issues/773.
This commit is contained in:
parent
149350bf39
commit
3ee3434187
24 changed files with 458 additions and 14 deletions
|
@ -29,7 +29,7 @@ mod diagnostic;
|
|||
mod matcher;
|
||||
mod parser;
|
||||
|
||||
const MDTEST_TEST_FILTER: &str = "MDTEST_TEST_FILTER";
|
||||
use ty_static::EnvVars;
|
||||
|
||||
/// Run `path` as a markdown test suite with given `title`.
|
||||
///
|
||||
|
@ -53,7 +53,7 @@ pub fn run(
|
|||
|
||||
let mut db = db::Db::setup();
|
||||
|
||||
let filter = std::env::var(MDTEST_TEST_FILTER).ok();
|
||||
let filter = std::env::var(EnvVars::MDTEST_TEST_FILTER).ok();
|
||||
let mut any_failures = false;
|
||||
for test in suite.tests() {
|
||||
if filter
|
||||
|
@ -105,10 +105,12 @@ pub fn run(
|
|||
|
||||
if output_format.is_cli() {
|
||||
println!(
|
||||
"\nTo rerun this specific test, set the environment variable: {MDTEST_TEST_FILTER}='{escaped_test_name}'",
|
||||
"\nTo rerun this specific test, set the environment variable: {}='{escaped_test_name}'",
|
||||
EnvVars::MDTEST_TEST_FILTER,
|
||||
);
|
||||
println!(
|
||||
"{MDTEST_TEST_FILTER}='{escaped_test_name}' cargo test -p ty_python_semantic --test mdtest -- {test_name}",
|
||||
"{}='{escaped_test_name}' cargo test -p ty_python_semantic --test mdtest -- {test_name}",
|
||||
EnvVars::MDTEST_TEST_FILTER,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue