diff --git a/mypy/dmypy_server.py b/mypy/dmypy_server.py index be2f4ab8d6182..7227cd5599468 100644 --- a/mypy/dmypy_server.py +++ b/mypy/dmypy_server.py @@ -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} diff --git a/test-data/unit/daemon.test b/test-data/unit/daemon.test index 56966b2f740cc..c72dc3a32bc7c 100644 --- a/test-data/unit/daemon.test +++ b/test-data/unit/daemon.test @@ -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]