Skip to content

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

Merged
AlexWaygood merged 1 commit intomainfrom
alex/unresolvable-submodule-errors
Dec 17, 2024
Merged

[red-knot] Explicitly test diagnostics are emitted for unresolvable submodule imports#15035
AlexWaygood merged 1 commit intomainfrom
alex/unresolvable-submodule-errors

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 ty 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
@AlexWaygood AlexWaygood deleted the alex/unresolvable-submodule-errors branch December 17, 2024 12:56
@github-actions
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

testing Related to testing Ruff itself ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants