-
Notifications
You must be signed in to change notification settings - Fork 249
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
4115 - Fix CI Typechecks #1385
4115 - Fix CI Typechecks #1385
Conversation
Lots of trial and error, incl. trying the latest treq which ships type annotations... in the end I just removed the stuff mypy was complaining about and it made the errors go away. Can it be as simple as that?
Sure, this makes it green .. but it changes the semantics? That is, See also twisted/treq#243 and twisted/treq#244 Put another way: if we want to change the type to demand |
I don't undertstand. Shouldn't mypy now complain about when we set
These are from 2019. Where am I wrong? |
We are using |
But only once, in a test, and there MyPy complained about something different - that |
This PR fixes https://tahoe-lafs.org/trac/tahoe-lafs/ticket/4115, which is about type checks. |
Well, it does make it green, by ignoring the type-check on |
That is one of three type problems this PR fixes, yes. It's the least important and interesting one of the three, IMHO: It's a one-time use in our test code. Should that ever fail at runtime it's just a failed unit test to fix. The type-check this ignores is that MyPy (erroneously) thinks |
Should I remove the ignore in the test code so you can fix that in a separate PR? |
Right, okay. Those tickets above say some things about this of course (that, yes, What I'm getting at is that the correct fix is to only use |
I am confused. Is that not what this change is ensuring? MyPy should from now on complain whenever we don't use HTTPClient here. |
Is this your required bar to merge this PR or can this wait until Treq deprecates the |
Approximately yes, but then where it did complain you just ignored it. If that's really the only use of
Not sure what you mean here. |
But that was about MyPy not knowing StubTreq well enough to know we can call a method on it, not about our API having not the right type annotations.
|
This reverts commit 1985eaa. It was pacifying MyPy but breaking the unit test at runtime.
If I understand correctly, we should be able to use I tried for a while but couldn't find a way to use HTTPClient here with the tests working. I revert to my earlier fix and again argue that MyPy is at fault here, not our code, and that my making it ignoring its wrong assumption that StubTreq has no If you don't like it @meejah please find a better fix, I am done wasting my time with this. |
Yes, that's what I was getting at: can we just replace StubTreq there with HTTPClient? Sounds like you're saying you tried now, and "no, we can't replace it"? |
Probably filing a followup ticket so we don't "forget" to migrate to HTTPClient would be good. Also, this failure on the "another-locale" builder looks probably-real and related to this?
|
I made a PR-to-this-PR showing how to fix at least that one instance (longer-term we should move as much as possible to this paradigm, which is what treq developers prefer as per the comments on their issue tracker). |
e27a830
That was my finding, but seemingly you proved me wrong in hacklschorsch#1. Is your patch equivalent to what |
That is new and happened with HTTPClient instead of StubTreq - but I wasn't supplying |
Fix Type checks on CircleCi.
Fixes ticket: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/4115