Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(check): don't raise error on pypi reference #9475

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Secrus
Copy link
Member

@Secrus Secrus commented Jun 6, 2024

Pull Request Check List

Resolves: #9436

  • Added tests for changed code.

src/poetry/console/commands/check.py Outdated Show resolved Hide resolved
@Secrus Secrus added this to the Poetry 2.0 milestone Oct 6, 2024
@Secrus Secrus force-pushed the pypi-ref branch 3 times, most recently from e0a4ce0 to a320010 Compare October 27, 2024 15:14
@Secrus Secrus requested a review from radoering October 27, 2024 15:14
tests/console/commands/test_check.py Outdated Show resolved Hide resolved
@@ -111,19 +127,55 @@ def test_check_valid_legacy(
assert tester.io.fetch_error() == expected


def test_check_invalid(
def test_check_invalid_dep_name_same_as_project_name(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for splitting (almost duplicating) the test and how is it related to the fix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old one was checking the dependency name vs project name. This is not possible with a fixture being a Poetry instance, so I moved this to another test to keep this case tested.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if we do not introduce the fixture, we do not have to split the test? Then, why introduce a fixture in the first place? (Further, it still seems unrelated to the test case for the fix.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to introduce the fixture because otherwise (with patching pyproject file) we get the wrong list of sources for the project.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still do not get why this is an issue. We now have two almost similar tests (test_check_invalid_dep_name_same_as_project_name and test_check_invalid). Both provide the same errors except for that the first one provides two more errors:

  • Error: Project name (invalid) is same as one of its dependencies
  • Error: Invalid source "exists" referenced in dependencies.

And both tests are unrelated to the issue that is resolved by this PR. This is tested in test_check_does_not_error_on_pypi_reference, which uses another fixture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: Invalid source "pypi" referenced in dependencies.
3 participants