Skip to content

Commit

Permalink
check: Remove compare_imports_to_dependencies()
Browse files Browse the repository at this point in the history
No longer in use.
  • Loading branch information
jherland committed Mar 6, 2023
1 parent b0fbc8d commit 24689e8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
20 changes: 0 additions & 20 deletions fawltydeps/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,3 @@ def calculate_unused(
UnusedDependency(name, [dep.source for dep in deps])
for name, deps in groupby(unused, key=lambda d: d.name)
]


def compare_imports_to_dependencies(
imports: List[ParsedImport],
dependencies: List[DeclaredDependency],
settings: Settings,
) -> Tuple[Dict[str, Package], List[UndeclaredDependency], List[UnusedDependency]]:
"""Compares imports to dependencies.
Returns set of undeclared imports and set of unused dependencies.
For undeclared dependencies returns files and line numbers
where they were imported in the code.
"""
# TODO consider empty list of dependency to import
packages = resolve_dependencies(dep.name for dep in dependencies)
return (
packages,
calculate_undeclared(imports, packages, settings),
calculate_unused(imports, dependencies, packages, settings),
)
15 changes: 0 additions & 15 deletions tests/test_compare_imports_to_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
LocalPackageLookup,
calculate_undeclared,
calculate_unused,
compare_imports_to_dependencies,
resolve_dependencies,
)
from fawltydeps.settings import Settings
Expand Down Expand Up @@ -261,17 +260,3 @@ def test_calculate_unused(vector):
vector.imports, vector.declared_deps, vector.expect_resolved_deps, settings
)
assert actual == vector.expect_unused_deps


@pytest.mark.parametrize("vector", [pytest.param(v, id=v.id) for v in testdata])
def test_compare_imports_to_dependencies(vector):
settings = Settings(
ignore_unused=vector.ignore_unused, ignore_undeclared=vector.ignore_undeclared
)
actual = compare_imports_to_dependencies(
vector.imports, vector.declared_deps, settings
)
actual_resolved_deps, actual_undeclared_deps, actual_unused_deps = actual
assert actual_resolved_deps == vector.expect_resolved_deps
assert actual_undeclared_deps == vector.expect_undeclared_deps
assert actual_unused_deps == vector.expect_unused_deps

0 comments on commit 24689e8

Please sign in to comment.