8000 Add support to pyproject.toml by pslacerda · Pull Request #5208 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Add support to pyproject.toml #5208

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
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

< 8000 div class="js-reset-filters diffbar-item hide-sm" data-target="diff-file-filter.resetFilters" hidden > Clear filters
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change some tests
  • Loading branch information
pslacerda authored and msullivan committed Oct 18, 2020
commit 5410ecbd815f54f3db6f0254d9862db3a32654e2
6 changes: 3 additions & 3 deletions mypy/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ def parse_toml_config_file(options: Options, set_strict_flags: Callable[[], None
else:
options.config_file = filename

if 'mypy' not in table:
print("%s: No [mypy] table in config file" % filename, file=stderr)
if 'tool' not in table or 'mypy' not in table['tool']:
print("%s: No 'tool.mypy' table in config file" % filename, file=stderr)
return False

# Handle the mypy table.
for key, value in table['mypy'].items():
for key, value in table['tool']['mypy'].items():

# Is an option.
if key != 'overrides':
Expand Down
10 changes: 5 additions & 5 deletions test-data/unit/cmdline.test
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def f():
[case testWarnUnusedIgnores]
# cmd: mypy main.py --config-file=pyproject.toml
[file pyproject.toml]
\[mypy]
\[tool.mypy]
warn_unused_ignores = true
[file main.py]
# type: ignore
Expand All @@ -186,17 +186,17 @@ main.py:1: error: unused 'type: ignore' comment
[file main.py]
# type: ignore
[out]
pyproject.toml: No [mypy] table in config file
pyproject.toml: No 'tool.mypy' table in config file
== Return code: 0

[case testPerFileConfigSection]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And changed this one because to increase TOML coverage. Was it right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer you create a separate test here if possible.

# cmd: mypy x.py y.py z.py
[file pyproject.toml]
\[mypy]
\[tool.mypy]
disallow_untyped_defs = true
\[mypy.overrides.y]
\[tool.mypy.overrides.y]
disallow_untyped_defs = false
\[mypy.overrides.z]
\[tool.mypy.overrides.z]
disallow_untyped_calls = true
[file x.py]
def f(a):
Expand Down
0