Skip to content

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

Closed

Description

@carljm

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.

Activity

  1. gvanrossum commented on Sep 30, 2017

    @gvanrossum
    Member

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

  2. emmatyping commented on Sep 30, 2017

    @emmatyping
    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.

  3. carljm commented on Oct 1, 2017

    @carljm
    MemberAuthor

    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.

  4. emmatyping commented on Oct 1, 2017

    @emmatyping
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions