pytest-mypy icon indicating copy to clipboard operation
pytest-mypy copied to clipboard

EncodingWarnings when warn_default_encoding set

Open jaraco opened this issue 3 years ago • 1 comments

When running tests with pytest-mypy enabled and PYTHONWARNDEFAULTENCODING=1, I see these warnings:

docs/conf.py::mypy
docs/conf.py::mypy
  /Users/jaraco/code/jaraco/pytest-enabler/.tox/python/lib/python3.11/site-packages/pytest_mypy.py:272: EncodingWarning: 'encoding' argument not specified
    stdout, stderr, status = mypy.api.run(

docs/conf.py::mypy
  /Users/jaraco/code/jaraco/pytest-enabler/.tox/python/lib/python3.11/site-packages/pytest_mypy.py:312: EncodingWarning: 'encoding' argument not specified
    with open(results_path, mode="w") as results_f:

docs/conf.py::mypy-status
pytest_enabler/__init__.py::mypy
tests/test_enabler.py::mypy
  /Users/jaraco/code/jaraco/pytest-enabler/.tox/python/lib/python3.11/site-packages/pytest_mypy.py:306: EncodingWarning: 'encoding' argument not specified
    with open(results_path, mode="r") as results_f:

================================================================================== mypy ===================================================================================
Success: no issues found in 3 source files
======================================================================== warnings summary (final) =========================================================================
.tox/python/lib/python3.11/site-packages/pytest_mypy.py:331
  /Users/jaraco/code/jaraco/pytest-enabler/.tox/python/lib/python3.11/site-packages/pytest_mypy.py:331: EncodingWarning: 'encoding' argument not specified
    with open(config._mypy_results_path, mode="r") as results_f:

See PEP 597 for background.

jaraco avatar Jan 27 '23 23:01 jaraco

Thanks for the report!

I can't figure out what's causing that first one:

docs/conf.py::mypy
docs/conf.py::mypy
  /Users/jaraco/code/jaraco/pytest-enabler/.tox/python/lib/python3.11/site-packages/pytest_mypy.py:272: EncodingWarning: 'encoding' argument not specified
    stdout, stderr, status = mypy.api.run(

I filed an issue with Mypy for that: https://github.com/python/mypy/issues/14603

dmtucker avatar Feb 04 '23 09:02 dmtucker