You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Skip Py2 subprocess tests if Py2 interpreter found does not have typing installed #4039
The behavior of mypy with regard to Python 2.7 tests is inconsistent. On the one hand, if no Python 2.7 interpreter can be found at all, https://github.com/python/mypy/blob/master/mypy/util.py#L66 will return None and mypy will happily skip the Py2 tests. But if a Python 2.7 interpreter is found, but is missing the typing backport (which mypy no longer bundles), mypy will go ahead and run the Py2 tests and they will fail.
Our build boxes are in the midst of an upgrade from an OS version with Python 2.6 as system Python to one with Python 2.7. On the older OS, mypy builds fine and just skips the Py2 tests (which is fine). On the newer OS, it finds the system Python 2.7 and those tests fail for lack of typing. It'sdifficult for us to install the typing module into the system Python on these hosts.
I propose that it would be more consistent if mypy considers "no Python 2.7 with typing available" equivalent to "no Python 2.7 available" and skips the Py2 tests. It would be quite easy to add a python -c "import typing" check to try_find_python2_interpreter. I can submit a PR for this, if the idea is approved.
Actually, this specific issue will no longer be a problem if #4025 is merged as-is. We will no longer require the runtime typing to be there. Furthermore, that change should remove our dependency on a runtime Python 2 all together, as we don't test evaluation of Python anymore.
It wasn't totally clear to me with ongoing discussion on #4025 whether the final result there would take care of this or not, so I went ahead and submitted #4041, which fixes it.
Activity
gvanrossum commentedon Sep 30, 2017
Sure, that sounds reasonable -- go ahead and send a PR.
emmatyping commentedon Sep 30, 2017
Actually, this specific issue will no longer be a problem if #4025 is merged as-is. We will no longer require the runtime
typingto be there. Furthermore, that change should remove our dependency on a runtime Python 2 all together, as we don't test evaluation of Python anymore.carljm commentedon Oct 1, 2017
It wasn't totally clear to me with ongoing discussion on #4025 whether the final result there would take care of this or not, so I went ahead and submitted #4041, which fixes it.
emmatyping commentedon Oct 1, 2017
Thank you! Based on Guido's feedback #4025 will not resolve this.