Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mypy/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def split_commas(value: str) -> list[str]:
"quickstart_file": expand_path,
"junit_xml": expand_path,
"junit_format": check_junit_format,
"output": str,
"follow_imports": check_follow_imports,
"no_site_packages": bool,
"plugins": lambda s: [p.strip() for p in split_commas(s)],
Expand Down
18 changes: 17 additions & 1 deletion mypy/test/test_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import tempfile
import unittest
from collections.abc import Iterator
from io import StringIO
from pathlib import Path

from mypy.config_parser import _find_config_file
from mypy.config_parser import _find_config_file, parse_config_file
from mypy.defaults import CONFIG_NAMES, SHARED_CONFIG_NAMES
from mypy.options import Options


@contextlib.contextmanager
Expand Down Expand Up @@ -128,3 +130,17 @@ def test_precedence_missing_section(self) -> None:
result = _find_config_file()
assert result is not None
assert Path(result[2]).resolve() == parent_mypy.resolve()


class ParseConfigFileSuite(unittest.TestCase):
def test_output_option_with_none_default(self) -> None:
with tempfile.TemporaryDirectory() as _tmpdir:
config = Path(_tmpdir) / "mypy.ini"
write_config(config, content="[mypy]\noutput = json\n")

options = Options()
stderr = StringIO()
parse_config_file(options, lambda: None, str(config), stderr=stderr)

assert options.output == "json"
assert stderr.getvalue() == ""
Loading