Skip to content

Improve test coverage of the Python2 bits of mypy #732

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
o11c opened this issue Aug 1, 2015 · 2 comments
Closed

Improve test coverage of the Python2 bits of mypy #732

o11c opened this issue Aug 1, 2015 · 2 comments

Comments

@o11c
Copy link
Contributor

o11c commented Aug 1, 2015

Plan:

  • Enable python2.7 and pypy2 sections on travis.
  • Note that travis always has all versions of python installed (this is useful e.g. with tox -e). Proof
  • Alter travis.py to only collect python2 tests in python2 mode, and only collects python3 tests in python3 mode.
  • Alter mypy/test/testpythoneval.py so that it can separately collect out python2 vs python3 tests.
  • Note that my driver branch already fixes the bug caused by the fact that python points to the currently-tested python3 version.
@JukkaL JukkaL added the task label Aug 4, 2015
@JukkaL
Copy link
Collaborator

JukkaL commented Aug 4, 2015

Sounds good! The current travis setup is clearly not optimal.

@o11c
Copy link
Contributor Author

o11c commented Oct 1, 2015

Since Python2 support is now a lot, and none of the stubs are being checked at all, the priority of this has gone up in my eyes, though likely it will still go after typeshed for sanity reasons.

Plan:

  • Backport the minimal bits of mypy.syntax.dialect (i.e. not the lexer differentiation, but yes the future stuff) and use it.
    • Should this include the third number? I didn't need, but typeshed says it should be supported.
    • Likely we want to add variant-pypy and variant-jython futures (note that '-' is not valid in real future names so we can't collide).
      • I do think we should be testing on Pypy.
    • When checking a .pyi file, add the mypy-codec future automatically.
  • Read a new environment variable MYPY_PYTHON, which takes the name of an executable. If unset, use the currently-running python instead. The --py2 option will try to run the first of python2, python2.7, python until it finds a suitable python executable.
    • If running under pypy3, should we prepend pypy2, pypy?
    • Call that executable and extract sys.path (to find stubs properly) and sys.version_info (to construct the Dialect object which should then be used everywhere)
    • Also use it in place of the current logic in testpythoneval.
  • On travis, export MYPY_PYTHON=python and then start the driver with python3.
    • The driver needs to learn to select the right set of tests for the current MYPY_PYTHON.

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