Use TYPE_CHECKING instead of False#6435
Conversation
dc46ddb to
fcb9ca5
Compare
|
Makes me wonder how common 3.5.0/3.5.1 really are in the wild - do we need/want to support them still? Also see some previous discussion in #5751. |
I'd be ok with dropping support for it, but did not want to hold that back (also since we had issues/reports with |
|
Unless keeping the support becomes too terrible, I would rather we wait until we drop 3.5 completely. |
nicoddemus
left a comment
There was a problem hiding this comment.
Thanks!
Please only add the CHANGELOG entry as requested, after that feel free to merge once CI passes. 👍
This comment has been minimized.
This comment has been minimized.
Python 3.5.0 caused flaky failures before (pytest-dev#5795), hopefully this is more stable. This is pulled out of pytest-dev#6435, which adds code specific for Python < 3.5.2, and therefore it makes sense to test it.
|
I'll rebase this (with changelog) after merging master after #6440. |
This comment has been minimized.
This comment has been minimized.
Python 3.5.0 caused flaky failures before (pytest-dev#5795), hopefully this is more stable. This is pulled out of pytest-dev#6435, which adds code specific for Python < 3.5.2, and therefore it makes sense to test it.
af3ef73 to
4d3dcbd
Compare
|
LGTM, as long as the dependency is only for Python<=3.5.1 it's fine by me :) According to the PR description, this fixes jedi type inference. According to the linked issue, the jedi maintainer says they're going to stop supporting Python 3.5 in a few months. So things are going to break for these users anyway. But I guess they can always use an older jedi with newer pytest, so it's not a good reason to not fix the issue. |
Python 3.5.0 caused flaky failures before (pytest-dev#5795). This is pulled out of pytest-dev#6435, which adds code specific for Python < 3.5.2. It only runs a specific test, while collecting everything to get coverage of the version specific code around typing.
Python 3.5.0 caused flaky failures before (pytest-dev#5795). This is pulled out of pytest-dev#6435, which adds code specific for Python < 3.5.2. It only runs a specific test, while collecting everything to get coverage of the version specific code around typing.
Python 3.5.0 caused flaky failures before (pytest-dev#5795). This is pulled out of pytest-dev#6435, which adds code specific for Python < 3.5.2. It only runs a specific test, while collecting everything to get coverage of the version specific code around typing.
4d3dcbd to
a6c3add
Compare
a6c3add to
f88035e
Compare
f88035e to
e3a77a2
Compare
The point of this is that Jedi will actually infer types (it skips |
6a12182 to
31b47d7
Compare
|
tbh, in addition i like the named constant better than the magic constant, lovely, thanks |
|
Searching the jedi repo for |
e5d7d84 to
12fc00c
Compare
|
Ok, falls back to |
Do you mean we should use |
|
@blueyed unless there is something making that a no go, i'd strongly prefer it over replicating it per file |
12fc00c to
444e8a9
Compare
|
@RonnyPfannschmidt Anyway, this is still affected by circular imports now, fixed by avoiding it there, instead of moving imports to methods: diff --git a/src/_pytest/outcomes.py b/src/_pytest/outcomes.py
index b08e7d2c9..0cd1072ef 100644
--- a/src/_pytest/outcomes.py
+++ b/src/_pytest/outcomes.py
@@ -8,7 +8,7 @@
from packaging.version import Version
-from _pytest.compat import TYPE_CHECKING
+TYPE_CHECKING = False # avoid circular import through compat
if TYPE_CHECKING:
from typing import NoReturn |
444e8a9 to
25b8d18
Compare
|
Should be good now. |
25b8d18 to
4d2a346
Compare
4d2a346 to
663d572
Compare
663d572 to
9cbf242
Compare
|
Rebased on master. |
This allows for e.g. Jedi to infer types (it checks the name). It was only used to support Python 3.5.0/3.5.1, where this is is not available in the `typing` module. Ref: davidhalter/jedi#1472 Uses `TYPE_CHECKING = False` in `_pytest.outcomes` to avoid having to work around circular import.
9cbf242 to
4630e27
Compare
This allows for e.g. Jedi to infer types.
It was only used to support Python 3.5.0/3.5.1, where this is available
in
typing_extensions.Ref: davidhalter/jedi#1472
TODO: