typeddjango/pytest-mypy-plugins

python_version is ignored, unable to test python 2 types

euresti opened this issue · 1 comments

I've got a test case that looks like this:

- case: testAttrsNewStyleClassPy2
  mypy_config:
    python_version = 2.7
  main: |
    import attr
    @attr.s
    class Good(object):
        pass
    @attr.s
    class Bad:  # E: attrs only works with new-style classes
        pass

But it doesn't pass because the python_version = 2.7 line seems to be ignored. I believe it has to do with how mypy is run.
mypy --python-version={current_interpreter}. But as there's no way to run mypy with python 2, then there's no way to test python2 types.

Here's the line you are interested in: https://github.com/typeddjango/pytest-mypy-plugins/blob/master/pytest_mypy_plugins/item.py#L130

PRs and fixes are welcome!