-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Silencing mmap mypy warning on windows #11570
Conversation
even though the lib doesn't exist on this platform
large_data = mmap.mmap(-1, 2**29 + 2**20, prot=mmap.PROT_READ) | ||
# Silencing mypy warning on Windows, even though mmap doesn't exist. See: | ||
# https://mypy.readthedocs.io/en/stable/common_issues.html#version-and-platform-checks | ||
if sys.platform == "win32": |
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.
Unfortunately this will produce coverage issues, since it's never reached.
I wonder if an assert sys.platform in {"linux", "darwin"}
would work?
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've seen it in the documentation, and tried it, as well as assert sys.platform != "win32"
, without any success. it seems it only works to silence the whole file 😞
Pushed new version, probably the dirtiest we can do without going for |
@@ -255,7 +255,7 @@ def test_update_into_buffer_too_small_gcm(self, backend): | |||
sys.platform not in {"linux", "darwin"}, reason="mmap required" | |||
) | |||
def test_update_auto_chunking(): | |||
large_data = mmap.mmap(-1, 2**29 + 2**20, prot=mmap.PROT_READ) | |||
large_data = large_mmap(length=2**29 + 2**20) |
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.
Regardless of the coverage bit, a PR that simply moved to a single utility function for these would be good.
Should be good, finally :) |
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.
This is dumb, I wish mypy had a better way to handle this, but thanks for chasing it down!
As per #11560. Even though the lib doesn't exist on Windows
Just realized coverage does not pass as such; the simplest solution would probably be
# type: ignore
😞