Skip to content

Commit

Permalink
fix(dependency_getter): only check for tool.poetry to detect Poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
mkniewallner committed Jul 4, 2024
1 parent 8999134 commit c2c34bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions python/deptry/dependency_getter/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/dependency_getter/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
),
(
Expand Down

0 comments on commit c2c34bf

Please sign in to comment.