Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus committed Sep 16, 2024
1 parent 3c2462c commit 8c965af
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ extend-exclude = [
"tests/masonry/builders/fixtures/pep_561_stub_only*/*",
"tests/utils/fixtures/setups/*",
]
fix = true
fix = false
line-length = 88
src = ["src"]
target-version = "py38"
Expand All @@ -123,6 +123,7 @@ extend-select = [
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"PTH"
]
ignore = [
"B904", # use 'raise ... from err'
Expand Down
6 changes: 4 additions & 2 deletions src/poetry/console/commands/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def _validate_readme(self, readme: str | list[str], poetry_file: Path) -> list[s

def _validate_dependencies_source(self, config: dict[str, Any]) -> list[str]:
"""Check dependencies's source are valid"""
sources = {k["name"] for k in config.get("source", [])}
sources.add("pypi")
sources = {repository.name for repository in self.poetry.pool.all_repositories}
print(sources)

dependency_declarations: list[
dict[str, str | dict[str, str] | list[dict[str, str]]]
Expand All @@ -119,6 +119,8 @@ def _validate_dependencies_source(self, config: dict[str, Any]) -> list[str]:
elif isinstance(declaration, dict) and "source" in declaration:
all_referenced_sources.add(declaration["source"])

print(all_referenced_sources)

return [
f'Invalid source "{source}" referenced in dependencies.'
for source in sorted(all_referenced_sources - sources)
Expand Down
1 change: 1 addition & 0 deletions tests/console/commands/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def test_check_valid(tester: CommandTester) -> None:
def test_check_invalid(
mocker: MockerFixture, tester: CommandTester, fixture_dir: FixtureDirGetter
) -> None:

mocker.patch(
"poetry.poetry.Poetry.file",
return_value=TOMLFile(fixture_dir("invalid_pyproject") / "pyproject.toml"),
Expand Down

0 comments on commit 8c965af

Please sign in to comment.