From c2c34bf8f758592cc4b939e743885e7a319f6c70 Mon Sep 17 00:00:00 2001 From: Mathieu Kniewallner Date: Fri, 5 Jul 2024 01:55:41 +0200 Subject: [PATCH] fix(dependency_getter): only check for `tool.poetry` to detect Poetry --- python/deptry/dependency_getter/builder.py | 6 +++--- tests/unit/dependency_getter/test_builder.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/deptry/dependency_getter/builder.py b/python/deptry/dependency_getter/builder.py index 14fb16f49..039b9533f 100644 --- a/python/deptry/dependency_getter/builder.py +++ b/python/deptry/dependency_getter/builder.py @@ -71,14 +71,14 @@ def _project_contains_pyproject_toml(self) -> bool: @staticmethod def _project_uses_poetry(pyproject_toml: dict[str, Any]) -> bool: try: - pyproject_toml["tool"]["poetry"]["dependencies"] + pyproject_toml["tool"]["poetry"] logging.debug( - "pyproject.toml contains a [tool.poetry.dependencies] section, so Poetry is used to specify the" + "pyproject.toml contains a [tool.poetry] section, so Poetry is used to specify the" " project's dependencies." ) except KeyError: logging.debug( - "pyproject.toml does not contain a [tool.poetry.dependencies] section, so Poetry is not used to specify" + "pyproject.toml does not contain a [tool.poetry] section, so Poetry is not used to specify" " the project's dependencies." ) return False diff --git a/tests/unit/dependency_getter/test_builder.py b/tests/unit/dependency_getter/test_builder.py index 5ea7ead4b..3164fbb1d 100644 --- a/tests/unit/dependency_getter/test_builder.py +++ b/tests/unit/dependency_getter/test_builder.py @@ -123,7 +123,7 @@ def test_dependency_specification_not_found_raises_exception(tmp_path: Path, cap assert caplog.messages == [ "pyproject.toml found!", ( - "pyproject.toml does not contain a [tool.poetry.dependencies] section, so Poetry is not used to specify the" + "pyproject.toml does not contain a [tool.poetry] section, so Poetry is not used to specify the" " project's dependencies." ), (