Fix TypeError when importing pytest on Python 3.5.0 and 3.5.1#5752
Fix TypeError when importing pytest on Python 3.5.0 and 3.5.1#5752asottile merged 6 commits intopytest-dev:masterfrom
Conversation
nicoddemus
left a comment
There was a problem hiding this comment.
Awesome @bluetech, thanks a lot for the quick fix.
In the future, I suggest you add "Fix ###" instead of "Refs: ###" as this will close the issue automatically when merged. 😉
|
Thanks for the review @nicoddemus. The reason I didn't close the issue is that I thought it'd be best to fix this regression quickly for 5.1.x, and then use the issue to discuss how to proceed. The options as I see them are:
For selfish reasons, my preference is obviously 2 :) |
The typing module on these versions have these issues: - `typing.Pattern` cannot appear in a Union since it is not considered a class. - `@overload` is not supported in runtime. (On the other hand, mypy doesn't support putting it under `if False`, so we need some runtime hack). Refs pytest-dev#5751.
809f11e to
9f3bfe8
Compare
|
Updated per comments, except for moving to |
looks like the comment about |
Even for Also @bluetech, would it be possible to add 3.5.0 to CI? |
|
Here's how trio does it: I think we can only add it to Travis as well, skipping Azure. 👍 |
|
I should probably also make |
|
I am not a fan of supporting 3.5.0 etc. I can see that Python 3.5 is still supported in general (until September 2020), but would vote for dropping support of it soon in pytest, especially given that we can benefit a lot from type annotations, and py35 make this much more unpleasant. |
|
I don't think we can drop py35 quite yet, maybe 3.5.0 / 3.5.1 though -- but in order to do that, we need to have a latest release that works correctly with those versions and then we can exclude them with that said, I think if I fixed |
|
yes that would be the goal |
|
Pulled in the testing with 3.5.0 on Travis. |
|
|
| - env: TOXENV=py35-xdist | ||
| python: '3.5' | ||
| dist: trusty | ||
| python: '3.5.0' |
There was a problem hiding this comment.
Based on my experience with Hypothesis, we need tests to ensure that Pytest's typing-related things don't regress on 3.5.0 or 3.5.x, meaning an additional environment rather than pinning to .0.
It's kinda annoying, but there we are - it's stuff like this that makes me worried about the exotic proposals for CPython release cadence and sympathetic to the "batteries are leaking" argument.
There was a problem hiding this comment.
We have 3.5.x in Azure, no?
btw: Django only supports the latest patch releases of Python versions.
|
I added a workaround for the |
|
i just catched up on prs, it looks like this one also sorts out #5770 as i |
|
@RonnyPfannschmidt yes, since |
|
@bluetech thanks for the update, great job |
nicoddemus
left a comment
There was a problem hiding this comment.
LGTM! Please consider my suggestions for improved coverage. 👍
|
@nicoddemus Updated, but the coverage check failed again. It is quite inscrutable, do you have any other ideas how to please it? |
I recommend just being honest and not excluding this. I agree that we do not have to run coverage for 3.5.0 though - which then @asottile |
I'm sorry you hate fun :P, consider blocking them |
I see it differently: a "pragma no cover", to me, is clear a indication on code about this shared agreement:
This way people in the future don't have to worry about covering those lines if we ever do a "let's get to 100% coverage" movement or such. But other than that I don't feel too strongly about it either way. 😁 |
That's not my kind of fun.. ;)
How? Using an ad block for their URL?
If that ever would be a goal then we should just run the coverage for 3.5.0 also. I do not feel too strong about it myself, but not adding the comment there would have been the easier (and slightly clearer) way. Just ignore the "hint" from codecov then. |
|
probably something like |


The typing module on these versions have these issues:
typing.Patterncannot appear in a Union since it is not considered aclass.
@overloadis not supported in runtime. (On the other hand, mypydoesn't support putting it under
if False, so we need some runtimehack).
Fix #5751
Fix #5770