diff --git a/python/deptry/core.py b/python/deptry/core.py index 74080e0a..cd39de5b 100644 --- a/python/deptry/core.py +++ b/python/deptry/core.py @@ -121,7 +121,7 @@ def _is_local_module(path: Path) -> bool: """Guess if a module is a local Python module.""" return bool( (path.is_file() and path.name != "__init__.py" and path.suffix == ".py") - or (path.is_dir() and list(path.rglob("*.py"))) + or (path.is_dir() and list(path.glob("*.py"))) ) @staticmethod diff --git a/tests/data/project_using_namespace/.gitignore b/tests/data/project_using_namespace/.gitignore deleted file mode 100644 index 796b96d1..00000000 --- a/tests/data/project_using_namespace/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/tests/data/project_using_namespace/foo/api/http.py b/tests/data/project_using_namespace/foo/api/http.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/data/project_using_namespace/foo/database/bar.py b/tests/data/project_using_namespace/foo/database/bar.py deleted file mode 100644 index bbd15a79..00000000 --- a/tests/data/project_using_namespace/foo/database/bar.py +++ /dev/null @@ -1,7 +0,0 @@ -from os import chdir, walk -from pathlib import Path - -import black -import white as w - -from foo import api diff --git a/tests/data/project_using_namespace/pyproject.toml b/tests/data/project_using_namespace/pyproject.toml deleted file mode 100644 index 51f0a727..00000000 --- a/tests/data/project_using_namespace/pyproject.toml +++ /dev/null @@ -1,17 +0,0 @@ -[project] -# PEP 621 project metadata -# See https://www.python.org/dev/peps/pep-0621/ -name = "foo" -version = "1.2.3" -requires-python = ">=3.7" -dependencies = ["toml"] - -[project.optional-dependencies] -dev = ["black==22.10.0"] - -[build-system] -requires = ["setuptools>=61.0.0"] -build-backend = "setuptools.build_meta" - -[tool.deptry] -pep621_dev_dependency_groups = ["dev"] diff --git a/tests/functional/cli/test_cli_namespace.py b/tests/functional/cli/test_cli_namespace.py deleted file mode 100644 index afb73885..00000000 --- a/tests/functional/cli/test_cli_namespace.py +++ /dev/null @@ -1,39 +0,0 @@ -from __future__ import annotations - -import uuid -from pathlib import Path -from typing import TYPE_CHECKING - -import pytest - -from tests.functional.utils import Project -from tests.utils import get_issues_report - -if TYPE_CHECKING: - from tests.utils import PipVenvFactory - - -@pytest.mark.xdist_group(name=Project.NAMESPACE) -def test_cli_with_namespace(pip_venv_factory: PipVenvFactory) -> None: - with pip_venv_factory(Project.NAMESPACE) as virtual_env: - issue_report = f"{uuid.uuid4()}.json" - result = virtual_env.run(f"deptry . -o {issue_report}") - - assert result.returncode == 1 - assert get_issues_report(Path(issue_report)) == [ - { - "error": {"code": "DEP004", "message": "'black' imported but declared as a dev dependency"}, - "module": "black", - "location": {"file": str(Path("foo/database/bar.py")), "line": 4, "column": 8}, - }, - { - "error": {"code": "DEP001", "message": "'white' imported but missing from the dependency definitions"}, - "module": "white", - "location": {"file": str(Path("foo/database/bar.py")), "line": 5, "column": 8}, - }, - { - "error": {"code": "DEP002", "message": "'toml' defined as a dependency but not used in the codebase"}, - "module": "toml", - "location": {"file": str(Path("pyproject.toml")), "line": None, "column": None}, - }, - ] diff --git a/tests/functional/utils.py b/tests/functional/utils.py index cee3fd29..08853829 100644 --- a/tests/functional/utils.py +++ b/tests/functional/utils.py @@ -11,7 +11,6 @@ class Project(str, Enum): FUTURE_DEPRECATED_OBSOLETE_ARGUMENT = "project_with_future_deprecated_obsolete_argument" GITIGNORE = "project_with_gitignore" MULTIPLE_SOURCE_DIRECTORIES = "project_with_multiple_source_directories" - NAMESPACE = "project_using_namespace" PDM = "project_with_pdm" POETRY = "project_with_poetry" PYPROJECT_DIFFERENT_DIRECTORY = "project_with_pyproject_different_directory"