Skip to content

Commit

Permalink
test_compare_imports_to_dependencies: Log inputs to tests
Browse files Browse the repository at this point in the history
This makes failing tests document their inputs, which is helpful when
debugging.
  • Loading branch information
jherland committed Mar 9, 2023
1 parent 3c4ab67 commit 3ce1bde
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_compare_imports_to_dependencies.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
"""Test the imports to dependencies comparison function."""
import logging

import pytest

from fawltydeps.check import calculate_undeclared, calculate_unused
from fawltydeps.settings import Settings

from .utils import test_vectors

logger = logging.getLogger(__name__)


@pytest.mark.parametrize("vector", [pytest.param(v, id=v.id) for v in test_vectors])
def test_calculate_undeclared(vector):
settings = Settings(ignore_undeclared=vector.ignore_undeclared)
logger.info(f"imports: {vector.imports!r}")
logger.info(f"declared_deps: {vector.declared_deps!r}")
logger.info(f"resolved_deps: {vector.expect_resolved_deps!r}")
actual = calculate_undeclared(vector.imports, vector.expect_resolved_deps, settings)
assert actual == vector.expect_undeclared_deps


@pytest.mark.parametrize("vector", [pytest.param(v, id=v.id) for v in test_vectors])
def test_calculate_unused(vector):
settings = Settings(ignore_unused=vector.ignore_unused)
logger.info(f"imports: {vector.imports!r}")
logger.info(f"declared_deps: {vector.declared_deps!r}")
logger.info(f"resolved_deps: {vector.expect_resolved_deps!r}")
actual = calculate_unused(
vector.imports, vector.declared_deps, vector.expect_resolved_deps, settings
)
Expand Down

0 comments on commit 3ce1bde

Please sign in to comment.