From bf9ea4144548e5a626e167663ec1637ef72e038f Mon Sep 17 00:00:00 2001 From: Charlie Denton Date: Thu, 13 Apr 2023 18:30:19 +0100 Subject: [PATCH] Add failing tests showing disappearing errors This shows two cases where errors disappear from the second run of dmypy. The first shows a way that "unused type ignore" errors can disappear. The case is a little complicated, but I can't yet work out how to make it smaller. The second case shows how "module X has not attribute Y" errors can disappear. --- test-data/unit/daemon.test | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/test-data/unit/daemon.test b/test-data/unit/daemon.test index 869f60b4e1fd..657d033420e9 100644 --- a/test-data/unit/daemon.test +++ b/test-data/unit/daemon.test @@ -611,3 +611,42 @@ from foo.empty import * if False: a = 1 a + +[case testUnusedTypeIgnorePreservedOnRerunWithIgnoredMissingImports] +$ dmypy start -- --no-error-summary --ignore-missing-imports --warn-unused-ignores +Daemon started +$ dmypy check foo +foo/main.py:3: error: Unused "type: ignore" comment +== Return code: 1 +$ dmypy check foo +foo/main.py:3: error: Unused "type: ignore" comment +== Return code: 1 + +[file unused/__init__.py] +[file unused/submodule.py] +[file foo/empty.py] +[file foo/__init__.py] +from foo.main import * +from unused.submodule import * +[file foo/main.py] +from foo import empty +from foo.does_not_exist import * +a = 1 # type: ignore + +[case testModuleDoesNotExistPreservedOnRerun] +$ dmypy start -- --no-error-summary --ignore-missing-imports +Daemon started +$ dmypy check foo +foo/main.py:1: error: Module "foo" has no attribute "does_not_exist" [attr-defined] +== Return code: 1 +$ dmypy check foo +foo/main.py:1: error: Module "foo" has no attribute "does_not_exist" [attr-defined] +== Return code: 1 + +[file unused/__init__.py] +[file unused/submodule.py] +[file foo/__init__.py] +from foo.main import * +[file foo/main.py] +from foo import does_not_exist +from unused.submodule import * pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy