Skip to content

Skip Py2 subprocess tests if Py2 interpreter found does not have typing installed #4039

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

Closed
carljm opened this issue Sep 30, 2017 · 4 comments

Comments

@carljm
Copy link
Member

carljm commented Sep 30, 2017

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.

@gvanrossum
Copy link
Member

Sure, that sounds reasonable -- go ahead and send a PR.

@emmatyping
Copy link
Member

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.

@carljm
Copy link
Member Author

carljm commented 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
Copy link
Member

Thank you! Based on Guido's feedback #4025 will not resolve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants