[ty] Move search path resolution to Options::to_program_settings (#18937)

This commit is contained in:
Micha Reiser 2025-06-25 18:00:38 +02:00 committed by GitHub
parent 8b22992988
commit 5d546c600a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 481 additions and 549 deletions

View file

@ -150,6 +150,7 @@ mod tests {
use insta::assert_snapshot;
use ruff_db::{
Db as _,
files::{File, system_path_to_file},
source::source_text,
};
@ -159,8 +160,7 @@ mod tests {
use ruff_db::system::{DbWithWritableSystem, SystemPathBuf};
use ty_python_semantic::{
Program, ProgramSettings, PythonPath, PythonPlatform, PythonVersionWithSource,
SearchPathSettings,
Program, ProgramSettings, PythonPlatform, PythonVersionWithSource, SearchPathSettings,
};
pub(super) fn inlay_hint_test(source: &str) -> InlayHintTest {
@ -188,20 +188,18 @@ mod tests {
let file = system_path_to_file(&db, "main.py").expect("newly written file to existing");
let search_paths = SearchPathSettings::new(vec![SystemPathBuf::from("/")])
.to_search_paths(db.system(), db.vendored())
.expect("Valid search path settings");
Program::from_settings(
&db,
ProgramSettings {
python_version: Some(PythonVersionWithSource::default()),
python_version: PythonVersionWithSource::default(),
python_platform: PythonPlatform::default(),
search_paths: SearchPathSettings {
extra_paths: vec![],
src_roots: vec![SystemPathBuf::from("/")],
custom_typeshed: None,
python_path: PythonPath::KnownSitePackages(vec![]),
},
search_paths,
},
)
.expect("Default settings to be valid");
);
InlayHintTest { db, file, range }
}