From e1cada1ec30d289acb00390058fab8bce765836e Mon Sep 17 00:00:00 2001 From: David Peter Date: Tue, 21 Oct 2025 14:40:23 +0200 Subject: [PATCH] [ty] Disable panicking mdtest (#21016) ## Summary Only run the "pull types" test after performing the "actual" mdtest. We observed that the order matters. There is currently one mdtest which panics when checked in the CLI or the playground. With this change, it also panics in the mdtest suite. reopens https://github.com/astral-sh/ty/issues/837? --- .../resources/mdtest/attributes.md | 10 +++-- crates/ty_test/src/lib.rs | 40 +++++++++---------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/crates/ty_python_semantic/resources/mdtest/attributes.md b/crates/ty_python_semantic/resources/mdtest/attributes.md index a71a40578b..94edff19e6 100644 --- a/crates/ty_python_semantic/resources/mdtest/attributes.md +++ b/crates/ty_python_semantic/resources/mdtest/attributes.md @@ -2551,11 +2551,13 @@ reveal_type(Answer.__members__) # revealed: MappingProxyType[str, Unknown] ## Divergent inferred implicit instance attribute types ```py -class C: - def f(self, other: "C"): - self.x = (other.x, 1) +# TODO: This test currently panics, see https://github.com/astral-sh/ty/issues/837 -reveal_type(C().x) # revealed: Unknown | tuple[Divergent, Literal[1]] +# class C: +# def f(self, other: "C"): +# self.x = (other.x, 1) +# +# reveal_type(C().x) # revealed: Unknown | tuple[Divergent, Literal[1]] ``` ## Attributes of standard library modules that aren't yet defined diff --git a/crates/ty_test/src/lib.rs b/crates/ty_test/src/lib.rs index 611fbbd6bf..f66eaaf26a 100644 --- a/crates/ty_test/src/lib.rs +++ b/crates/ty_test/src/lib.rs @@ -323,26 +323,6 @@ fn run_test( let mut failures: Failures = test_files .iter() .filter_map(|test_file| { - let pull_types_result = attempt_test( - db, - pull_types, - test_file, - "\"pull types\"", - Some( - "Note: either fix the panic or add the `` \ - directive to this test", - ), - ); - match pull_types_result { - Ok(()) => {} - Err(failures) => { - any_pull_types_failures = true; - if !test.should_skip_pulling_types() { - return Some(failures); - } - } - } - let parsed = parsed_module(db, test_file.file).load(db); let mut diagnostics: Vec = parsed @@ -387,6 +367,26 @@ fn run_test( })); } + let pull_types_result = attempt_test( + db, + pull_types, + test_file, + "\"pull types\"", + Some( + "Note: either fix the panic or add the `` \ + directive to this test", + ), + ); + match pull_types_result { + Ok(()) => {} + Err(failures) => { + any_pull_types_failures = true; + if !test.should_skip_pulling_types() { + return Some(failures); + } + } + } + failure }) .collect();