-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add tests for case-sensitive module resolution #16517
base: main
Are you sure you want to change the base?
Conversation
1c4abaf
to
d11b254
Compare
f7e3f8c
to
aebf24a
Compare
aebf24a
to
ad5e00e
Compare
`a.py`: | ||
|
||
```py | ||
class A: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think using a class named A
in these tests is confusing for no benefit, when it could be named C
or anything else
from db.A import A | ||
``` | ||
|
||
## Incorrectly extension casing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Incorrectly extension casing | |
## Incorrect extension casing |
x: int = 1 | ||
``` | ||
|
||
```python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love having our mdtests start to use an essentially-random mix of py
vs python
, but IIRC your editor makes it hard for you to use py
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RustRover always suggests python
and not py
. It's also hard-coded in my brain because that's what I used consistently everywhere before red knot (there are more than 103 matches for ```python in our code base).
@@ -118,7 +118,7 @@ fn run_test( | |||
} | |||
|
|||
assert!( | |||
matches!(embedded.lang, "py" | "pyi" | "text"), | |||
matches!(embedded.lang, "py" | "pyi" | "python" | "text"), | |||
"Supported file types are: py, pyi, text" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the assertion message may now need to be updated to mention python
? Which means we may also want to change the message so it talks about "language tags" rather than "file types"
Summary
Python's module resolver is case sensitive.
This PR adds mdtests that assert that our module resolution is case sensitive.
The tests currently all pass because our in memory file system is case sensitive.
I'll add support for using the real file system to the mdtest framework in a separate PR.
This PR also adds support for specifying extra search paths to the mdtest framework.
Test Plan
The tests fail when running them using the real file system.