mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:35 +00:00
Add snapshot tests for resolver (#5404)
## Summary This PR adds some snapshot tests for the resolver based on executing resolutions within a "mock" of the Airflow repo (that is: a folder that contains a subset of the repo's files, but all empty, and with an only-partially-complete virtual environment). It's intended to act as a lightweight integration test, to enable us to test resolutions on a "real" project without adding a dependency on Airflow itself.
This commit is contained in:
parent
a68a86e18b
commit
6587fb844a
32 changed files with 391 additions and 22 deletions
|
@ -1,9 +1,9 @@
|
|||
//! Interface that describes the output of the import resolver.
|
||||
|
||||
use crate::implicit_imports::ImplicitImport;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::implicit_imports::ImplicitImport;
|
||||
use crate::py_typed::PyTypedInfo;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
|
@ -69,11 +69,11 @@ pub(crate) struct ImportResult {
|
|||
|
||||
/// A map from file to resolved path, for all implicitly imported
|
||||
/// modules that are part of a namespace package.
|
||||
pub(crate) implicit_imports: HashMap<String, ImplicitImport>,
|
||||
pub(crate) implicit_imports: BTreeMap<String, ImplicitImport>,
|
||||
|
||||
/// Any implicit imports whose symbols were explicitly imported (i.e., via
|
||||
/// a `from x import y` statement).
|
||||
pub(crate) filtered_implicit_imports: HashMap<String, ImplicitImport>,
|
||||
pub(crate) filtered_implicit_imports: BTreeMap<String, ImplicitImport>,
|
||||
|
||||
/// If the import resolved to a type hint (i.e., a `.pyi` file), then
|
||||
/// a non-type-hint resolution will be stored here.
|
||||
|
@ -105,8 +105,8 @@ impl ImportResult {
|
|||
is_stdlib_typeshed_file: false,
|
||||
is_third_party_typeshed_file: false,
|
||||
is_local_typings_file: false,
|
||||
implicit_imports: HashMap::default(),
|
||||
filtered_implicit_imports: HashMap::default(),
|
||||
implicit_imports: BTreeMap::default(),
|
||||
filtered_implicit_imports: BTreeMap::default(),
|
||||
non_stub_import_result: None,
|
||||
py_typed_info: None,
|
||||
package_directory: None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue