[ty] Improve resolution of absolute imports in tests (#21817)
By teaching desperate resolution to try every possible ancestor that doesn't have an `__init__.py(i)` when resolving absolute imports. * Fixes https://github.com/astral-sh/ty/issues/1782
This commit is contained in:
@@ -2390,14 +2390,14 @@ fn default_root_flat_layout() -> anyhow::Result<()> {
|
||||
fn default_root_tests_folder() -> anyhow::Result<()> {
|
||||
let case = CliTest::with_files([
|
||||
("src/foo.py", "foo = 10"),
|
||||
("tests/bar.py", "bar = 20"),
|
||||
("tests/bar.py", "baz = 20"),
|
||||
(
|
||||
"tests/test_bar.py",
|
||||
r#"
|
||||
from foo import foo
|
||||
from bar import bar
|
||||
from bar import baz
|
||||
|
||||
print(f"{foo} {bar}")
|
||||
print(f"{foo} {baz}")
|
||||
"#,
|
||||
),
|
||||
])?;
|
||||
|
||||
Reference in New Issue
Block a user