Skip to content

Commit

Permalink
mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
fpgmaas committed Mar 17, 2024
1 parent 313af12 commit 9553dd1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion python/deptry/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _get_dependencies(self, dependency_management_format: DependencyManagementFo
return PDMDependencyGetter(self.config, self.package_module_name_map).get()
if dependency_management_format is DependencyManagementFormat.PEP_621:
return PEP621DependencyGetter(self.config, self.package_module_name_map).get()
if dependency_management_format is DependencyManagementFormat.requirements_file:
if dependency_management_format is DependencyManagementFormat.REQUIREMENTS_FILE:
return RequirementsTxtDependencyGetter(
self.config, self.package_module_name_map, self.requirements_file, self.requirements_file_dev
).get()
Expand Down
4 changes: 2 additions & 2 deletions python/deptry/dependency_specification_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DependencyManagementFormat(Enum):
PDM = "pdm"
PEP_621 = "pep_621"
POETRY = "poetry"
REQUIREMENTS_TXT = "requirements_file"
REQUIREMENTS_FILE = "requirements_file"


class DependencySpecificationDetector:
Expand All @@ -38,7 +38,7 @@ def detect(self) -> DependencyManagementFormat:
if pyproject_toml_found and self._project_uses_pep_621():
return DependencyManagementFormat.PEP_621
if self._project_uses_requirements_file():
return DependencyManagementFormat.REQUIREMENTS_TXT
return DependencyManagementFormat.REQUIREMENTS_FILE

raise DependencySpecificationNotFoundError(self.requirements_file)

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/deprecate/test_requirements_txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}


def test_requirements_txt_deprecated():
def test_requirements_txt_deprecated() -> None:
with patch("deptry.cli.Core") as mock_core, patch("logging.warning") as mock_warning:
result = CliRunner().invoke(deptry, [".", "--requirements-txt", "somefile.txt"])

Expand All @@ -41,7 +41,7 @@ def test_requirements_txt_deprecated():
)


def test_requirements_txt_dev_deprecated():
def test_requirements_txt_dev_deprecated() -> None:
with patch("deptry.cli.Core") as mock_core, patch("logging.warning") as mock_warning:
result = CliRunner().invoke(deptry, [".", "--requirements-txt-dev", "somefile.txt"])

Expand All @@ -54,7 +54,7 @@ def test_requirements_txt_dev_deprecated():
)


def test_requirements_file_works_as_expected():
def test_requirements_file_works_as_expected() -> None:
with patch("deptry.cli.Core") as mock_core, patch("logging.warning") as mock_warning:
result = CliRunner().invoke(deptry, [".", "--requirements-file", "somefile.txt"])

Expand All @@ -69,7 +69,7 @@ def test_requirements_file_works_as_expected():
)


def test_requirements_file_dev_works_as_expected():
def test_requirements_file_dev_works_as_expected() -> None:
with patch("deptry.cli.Core") as mock_core, patch("logging.warning") as mock_warning:
result = CliRunner().invoke(deptry, [".", "--requirements-file-dev", "somefile.txt"])

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_dependency_specification_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_requirements_file(tmp_path: Path) -> None:
f.write('foo >= "1.0"')

spec = DependencySpecificationDetector(Path("pyproject.toml")).detect()
assert spec == DependencyManagementFormat.REQUIREMENTS_TXT
assert spec == DependencyManagementFormat.REQUIREMENTS_FILE


def test_pdm_with_dev_dependencies(tmp_path: Path) -> None:
Expand Down Expand Up @@ -90,7 +90,7 @@ def test_requirements_file_with_argument(tmp_path: Path) -> None:
f.write('foo >= "1.0"')

spec = DependencySpecificationDetector(Path("pyproject.toml"), requirements_file=("req.txt",)).detect()
assert spec == DependencyManagementFormat.REQUIREMENTS_TXT
assert spec == DependencyManagementFormat.REQUIREMENTS_FILE


def test_requirements_file_with_argument_not_root_directory(tmp_path: Path) -> None:
Expand All @@ -101,7 +101,7 @@ def test_requirements_file_with_argument_not_root_directory(tmp_path: Path) -> N
f.write('foo >= "1.0"')

spec = DependencySpecificationDetector(Path("pyproject.toml"), requirements_file=("req/req.txt",)).detect()
assert spec == DependencyManagementFormat.REQUIREMENTS_TXT
assert spec == DependencyManagementFormat.REQUIREMENTS_FILE


def test_dependency_specification_not_found_raises_exception(tmp_path: Path) -> None:
Expand Down

0 comments on commit 9553dd1

Please sign in to comment.