Skip to content
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

Prevent warnings from causing dmypy to fail #14102

Merged
merged 2 commits into from
Nov 15, 2022
Merged
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
3 changes: 2 additions & 1 deletion mypy/dmypy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,8 @@ def initialize_fine_grained(

print_memory_profile(run_gc=False)

status = 1 if messages else 0
__, n_notes, __ = count_stats(messages)
status = 1 if messages and n_notes < len(messages) else 0
messages = self.pretty_messages(messages, len(sources), is_tty, terminal_width)
return {"out": "".join(s + "\n" for s in messages), "err": "", "status": status}

Expand Down
14 changes: 14 additions & 0 deletions test-data/unit/daemon.test
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,20 @@ mypy-daemon: error: Missing target module, package, files, or command.
$ dmypy stop
Daemon stopped

[case testDaemonWarningSuccessExitCode-posix]
$ dmypy run -- foo.py --follow-imports=error
Daemon started
foo.py:2: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
Success: no issues found in 1 source file
$ echo $?
0
$ dmypy stop
Daemon stopped
[file foo.py]
def foo():
a: int = 1
print(a + "2")

-- this is carefully constructed to be able to break if the quickstart system lets
-- something through incorrectly. in particular, the files need to have the same size
[case testDaemonQuickstart]
Expand Down