typeddjango / pytest-mypy-plugins

pytest plugin for testing mypy types, stubs, and plugins
https://pypi.org/project/pytest-mypy-plugins/
MIT License
102 stars 24 forks source link

mypy_config documentation is confusing #94

Open whitphx opened 2 years ago

whitphx commented 2 years ago

The mypy_config field accepts a string as below.

- case: foo
  mypy_config:
    python_version = 3.8

So, if we want to provide multi fields, it would be like below, where the value of mypy_config in the YAML format is of type str.

- case: foo
  mypy_config: |
    python_version = 3.8
    ignore_missing_imports = True

However, the document says its type is Optional[Dict[str, Union[str, int, bool, float]]]={} which I think means the following YAML format (dict syntax) is accepted.

- case: foo
  mypy_config:
    python_version: 3.8
    ignore_missing_imports: true

but actually it is not.


My suggestion is either

because the files field, which is documented to accept Optional[List[File]]=[] type, can be specified with the YAML list syntax like

    - path: myapp/__init__.py

, which is inconsistent and confusing.


The same problem is there on the env field. Its type is documented as Optional[Dict[str, str]]={}, but the YAML syntax for the field is list as follows:

  env:
    - MYPYPATH=./pytest_mypy_plugins/tests/fixtures
sobolevn commented 2 years ago

Let's change it to be str, this is more flexible. Do you want to work on this? 🙂

whitphx commented 2 years ago

Thank you, but no. Please do it on your side 🙏