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

[red-knot] Explicitly test diagnostics are emitted for unresolvable submodule imports #15035

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

AlexWaygood
Copy link
Member

Everything's working as expected here, but we didn't have explicit tests for these; this PR just adds some missing cases

@AlexWaygood AlexWaygood added the red-knot Multi-file analysis & type inference label Dec 17, 2024
@AlexWaygood AlexWaygood enabled auto-merge (squash) December 17, 2024 12:51
@AlexWaygood AlexWaygood merged commit 463046a into main Dec 17, 2024
20 checks passed
@AlexWaygood AlexWaygood deleted the alex/unresolvable-submodule-errors branch December 17, 2024 12:56
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@AlexWaygood AlexWaygood added the testing Related to testing Ruff itself label Dec 17, 2024
dcreager added a commit that referenced this pull request Dec 17, 2024
* main:
  [red-knot] Explicitly test diagnostics are emitted for unresolvable submodule imports (#15035)
  Fix stale File status in tests (#15030)
  [red-knot] Basic support for other legacy `typing` aliases (#14998)
  feat(AIR302): extend the following rules (#15015)
  [`perflint`] Simplify finding the loop target in `PERF401` (#15025)
  [red-knot] Avoid undeclared path when raising conflicting declarations (#14958)
import a.foo # error: [unresolved-import] "Cannot resolve import `a.foo`"

# Topmost component unresolvable:
import b.foo # error: [unresolved-import] "Cannot resolve import `b.foo`"
Copy link
Contributor

@T-256 T-256 Dec 17, 2024

Choose a reason for hiding this comment

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

IMO, this message could mention only b. it'd improve discoverability when debugging.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, there's definitely room for improvement here. I mainly wanted to add a test that made sure that we emitted a diagnostic on both of these (because I nearly proposed a refactor that would have accidentally made that not-the-case, and no tests failed on my bad patch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference testing Related to testing Ruff itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants