Skip to content

Commit 65b39f2

Browse files
[ty] Add support for using the test command emitted when a mdtest fails (#19794)
## Summary When seeing a failed test like ```bash is_subtype_of.md - Subtype relation - Callable - Class literals - Classes with `__new_… (1e9782853227c019) crates/ty_python_semantic/resources/mdtest/type_properties/is_subtype_of.md:1810 unexpected error: [unresolved-reference] "Name `Aa` used when not defined" To rerun this specific test, set the environment variable: MDTEST_TEST_FILTER='is_subtype_of.md - Subtype relation - Callable - Class literals - Classes with `__new_… (1e9782853227c019)' MDTEST_TEST_FILTER='is_subtype_of.md - Subtype relation - Callable - Class literals - Classes with `__new_… (1e9782853227c019)' cargo test -p ty_python_semantic --test mdtest -- mdtest__type_properties_is_subtype_of ``` running the following now works ```bash MDTEST_TEST_FILTER='is_subtype_of.md - Subtype relation - Callable - Class literals - Classes with `__new_… (1e9782853227c019)' cargo test -p ty_python_semantic --test mdtest -- mdtest__type_properties_is_subtype_of ``` ## Test Plan Do we have tests for the test runner? :)
1 parent 585ce12 commit 65b39f2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crates/ty_test/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub fn run(
5858
for test in suite.tests() {
5959
if filter
6060
.as_ref()
61-
.is_some_and(|f| !test.uncontracted_name().contains(f))
61+
.is_some_and(|f| !(test.uncontracted_name().contains(f) || test.name() == *f))
6262
{
6363
continue;
6464
}

0 commit comments

Comments
 (0)