mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:41:23 +00:00
[ty] Enable more corpus tests (#18531)
This commit is contained in:
parent
6e785867c3
commit
503427855d
1 changed files with 30 additions and 2 deletions
|
@ -59,7 +59,6 @@ fn linter_gz_no_panic() -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore = "Enable running once there are fewer failures"]
|
|
||||||
fn linter_stubs_no_panic() -> anyhow::Result<()> {
|
fn linter_stubs_no_panic() -> anyhow::Result<()> {
|
||||||
let workspace_root = get_cargo_workspace_root()?;
|
let workspace_root = get_cargo_workspace_root()?;
|
||||||
run_corpus_tests(&format!(
|
run_corpus_tests(&format!(
|
||||||
|
@ -68,7 +67,6 @@ fn linter_stubs_no_panic() -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore = "Enable running over typeshed stubs once there are fewer failures"]
|
|
||||||
fn typeshed_no_panic() -> anyhow::Result<()> {
|
fn typeshed_no_panic() -> anyhow::Result<()> {
|
||||||
let workspace_root = get_cargo_workspace_root()?;
|
let workspace_root = get_cargo_workspace_root()?;
|
||||||
run_corpus_tests(&format!(
|
run_corpus_tests(&format!(
|
||||||
|
@ -119,6 +117,11 @@ fn run_corpus_tests(pattern: &str) -> anyhow::Result<()> {
|
||||||
let code = std::fs::read_to_string(source)?;
|
let code = std::fs::read_to_string(source)?;
|
||||||
|
|
||||||
let mut check_with_file_name = |path: &SystemPath| {
|
let mut check_with_file_name = |path: &SystemPath| {
|
||||||
|
if DO_NOT_ATTEMPT.contains(&&*relative_path.as_str().replace('\\', "/")) {
|
||||||
|
println!("Skipping {relative_path:?} due to known stack overflow");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
memory_fs.write_file_all(path, &code).unwrap();
|
memory_fs.write_file_all(path, &code).unwrap();
|
||||||
File::sync_path(&mut db, path);
|
File::sync_path(&mut db, path);
|
||||||
|
|
||||||
|
@ -298,4 +301,29 @@ const KNOWN_FAILURES: &[(&str, bool, bool)] = &[
|
||||||
// Fails with too-many-cycle-iterations due to a self-referential
|
// Fails with too-many-cycle-iterations due to a self-referential
|
||||||
// type alias, see https://github.com/astral-sh/ty/issues/256
|
// type alias, see https://github.com/astral-sh/ty/issues/256
|
||||||
("crates/ruff_linter/resources/test/fixtures/pyflakes/F401_34.py", true, true),
|
("crates/ruff_linter/resources/test/fixtures/pyflakes/F401_34.py", true, true),
|
||||||
|
|
||||||
|
// These are all "expression should belong to this TypeInference region and TypeInferenceBuilder should have inferred a type for it"
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/abc.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/annotationlib.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/ast.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/builtins.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/curses/__init__.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/dataclasses.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/inspect.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/lzma.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/os/__init__.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/pathlib/__init__.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/pathlib/types.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/pstats.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/signal.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/socket.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/sqlite3/__init__.pyi", true, true),
|
||||||
|
("crates/ty_vendored/vendor/typeshed/stdlib/tempfile.pyi", true, true),
|
||||||
|
];
|
||||||
|
|
||||||
|
/// Attempting to check one of these files causes a stack overflow
|
||||||
|
const DO_NOT_ATTEMPT: &[&str] = &[
|
||||||
|
"crates/ty_vendored/vendor/typeshed/stdlib/pathlib/types.pyi",
|
||||||
|
"crates/ty_vendored/vendor/typeshed/stdlib/types.pyi",
|
||||||
|
"crates/ty_vendored/vendor/typeshed/stdlib/wsgiref/types.pyi",
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue