From 4591d57dab300b306be3b5dc414d9eaf7fe008f7 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 30 Jan 2023 17:13:25 +0000 Subject: [PATCH 1/9] [DO-NOT-MERGE] Checking to see if pyright verifies test cases against false negatives correctly --- stubs/invoke/@tests/test_cases/check_task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/invoke/@tests/test_cases/check_task.py b/stubs/invoke/@tests/test_cases/check_task.py index 06b96ad7966f..adfea76e2526 100644 --- a/stubs/invoke/@tests/test_cases/check_task.py +++ b/stubs/invoke/@tests/test_cases/check_task.py @@ -9,7 +9,7 @@ @task -def docker_build(context: Context) -> None: +def docker_build(context: Context) -> None: # type: ignore pass From ac1f537445f7e891522665ebda0febc5c34cd333 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 30 Jan 2023 17:28:52 +0000 Subject: [PATCH 2/9] Does this make pyright error --- stubs/invoke/@tests/test_cases/check_task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/invoke/@tests/test_cases/check_task.py b/stubs/invoke/@tests/test_cases/check_task.py index adfea76e2526..7aacff348def 100644 --- a/stubs/invoke/@tests/test_cases/check_task.py +++ b/stubs/invoke/@tests/test_cases/check_task.py @@ -1,4 +1,4 @@ -# pyright: reportUnnecessaryTypeIgnoreComment=true +# pyright: enableTypeIgnoreComments=true from __future__ import annotations from invoke import Context, task From 5155c7513f8ea63abc6ccb533aa740cf2e15ee7b Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Mon, 30 Jan 2023 17:52:48 +0000 Subject: [PATCH 3/9] How about this --- pyrightconfig.json | 4 ++++ pyrightconfig.stricter.json | 2 ++ pyrightconfig.testcases.json | 1 + stubs/invoke/@tests/test_cases/check_task.py | 1 - 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pyrightconfig.json b/pyrightconfig.json index 49419acd78e5..7736a06327e1 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -5,6 +5,10 @@ "stdlib", "stubs", ], + "exclude": [ + // test cases use a custom config file + "stubs/*/@tests/test_cases/**/*.py" + ], "typeCheckingMode": "basic", "strictListInference": true, "strictDictionaryInference": true, diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index e1f103e1c3b0..3d59e3fe0595 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -6,6 +6,8 @@ "stubs", ], "exclude": [ + // test cases use a custom pyrightconfig file + "stubs/*/@tests/test_cases/**/*.py" "stdlib/distutils/command", "stdlib/lib2to3/refactor.pyi", "stdlib/_tkinter.pyi", diff --git a/pyrightconfig.testcases.json b/pyrightconfig.testcases.json index 25c51569dd3b..29114e6babf3 100644 --- a/pyrightconfig.testcases.json +++ b/pyrightconfig.testcases.json @@ -3,6 +3,7 @@ "typeshedPath": ".", "include": [ "test_cases", + "stubs/*/@tests/test_cases/**/*.py" ], "typeCheckingMode": "strict", // Using unspecific "type ignore" comments in test_cases. diff --git a/stubs/invoke/@tests/test_cases/check_task.py b/stubs/invoke/@tests/test_cases/check_task.py index 7aacff348def..a37dc58071cb 100644 --- a/stubs/invoke/@tests/test_cases/check_task.py +++ b/stubs/invoke/@tests/test_cases/check_task.py @@ -1,4 +1,3 @@ -# pyright: enableTypeIgnoreComments=true from __future__ import annotations from invoke import Context, task From 1abfd2905930ddd7a77539c627fd31e52453e555 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Mon, 30 Jan 2023 17:57:06 +0000 Subject: [PATCH 4/9] this? --- pyrightconfig.json | 2 +- pyrightconfig.stricter.json | 2 +- pyrightconfig.testcases.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrightconfig.json b/pyrightconfig.json index 7736a06327e1..1b641a922f4a 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -7,7 +7,7 @@ ], "exclude": [ // test cases use a custom config file - "stubs/*/@tests/test_cases/**/*.py" + "stubs/*/@tests/test_cases/*.py" ], "typeCheckingMode": "basic", "strictListInference": true, diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index 3d59e3fe0595..40e5bcc4ed7e 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -7,7 +7,7 @@ ], "exclude": [ // test cases use a custom pyrightconfig file - "stubs/*/@tests/test_cases/**/*.py" + "stubs/*/@tests/test_cases/*.py" "stdlib/distutils/command", "stdlib/lib2to3/refactor.pyi", "stdlib/_tkinter.pyi", diff --git a/pyrightconfig.testcases.json b/pyrightconfig.testcases.json index 29114e6babf3..eadfcf544193 100644 --- a/pyrightconfig.testcases.json +++ b/pyrightconfig.testcases.json @@ -3,7 +3,7 @@ "typeshedPath": ".", "include": [ "test_cases", - "stubs/*/@tests/test_cases/**/*.py" + "stubs/*/@tests/test_cases/*.py" ], "typeCheckingMode": "strict", // Using unspecific "type ignore" comments in test_cases. From 99d253952f0e2524eae10ce28aba57a1edbdd4ec Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Mon, 30 Jan 2023 18:02:08 +0000 Subject: [PATCH 5/9] this?? --- pyrightconfig.json | 2 +- pyrightconfig.stricter.json | 2 +- pyrightconfig.testcases.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrightconfig.json b/pyrightconfig.json index 1b641a922f4a..ddbde5bd5a14 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -7,7 +7,7 @@ ], "exclude": [ // test cases use a custom config file - "stubs/*/@tests/test_cases/*.py" + "**/@tests/test_cases" ], "typeCheckingMode": "basic", "strictListInference": true, diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index 40e5bcc4ed7e..8e543fa11a26 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -7,7 +7,7 @@ ], "exclude": [ // test cases use a custom pyrightconfig file - "stubs/*/@tests/test_cases/*.py" + "**/@tests/test_cases" "stdlib/distutils/command", "stdlib/lib2to3/refactor.pyi", "stdlib/_tkinter.pyi", diff --git a/pyrightconfig.testcases.json b/pyrightconfig.testcases.json index eadfcf544193..c9e075a3d2a8 100644 --- a/pyrightconfig.testcases.json +++ b/pyrightconfig.testcases.json @@ -3,7 +3,7 @@ "typeshedPath": ".", "include": [ "test_cases", - "stubs/*/@tests/test_cases/*.py" + "**/@tests/test_cases" ], "typeCheckingMode": "strict", // Using unspecific "type ignore" comments in test_cases. From dabb2e8494e118b244a1f3565267eade4f1b561f Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Wed, 1 Feb 2023 14:27:21 +0000 Subject: [PATCH 6/9] Improve --- pyrightconfig.json | 2 +- pyrightconfig.stricter.json | 2 +- pyrightconfig.testcases.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrightconfig.json b/pyrightconfig.json index ddbde5bd5a14..f9b2192dbb37 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -7,7 +7,7 @@ ], "exclude": [ // test cases use a custom config file - "**/@tests/test_cases" + "stubs*/@tests/test_cases" ], "typeCheckingMode": "basic", "strictListInference": true, diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index 8e543fa11a26..028f3be362ff 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -7,7 +7,7 @@ ], "exclude": [ // test cases use a custom pyrightconfig file - "**/@tests/test_cases" + "stubs/*/@tests/test_cases" "stdlib/distutils/command", "stdlib/lib2to3/refactor.pyi", "stdlib/_tkinter.pyi", diff --git a/pyrightconfig.testcases.json b/pyrightconfig.testcases.json index c9e075a3d2a8..0de5e5261792 100644 --- a/pyrightconfig.testcases.json +++ b/pyrightconfig.testcases.json @@ -3,7 +3,7 @@ "typeshedPath": ".", "include": [ "test_cases", - "**/@tests/test_cases" + "stubs/*/@tests/test_cases" ], "typeCheckingMode": "strict", // Using unspecific "type ignore" comments in test_cases. From a1213aa5cc1b711d1b4f11e80e5fa81cc7b919bb Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 1 Feb 2023 14:31:41 +0000 Subject: [PATCH 7/9] oops --- pyrightconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrightconfig.json b/pyrightconfig.json index f9b2192dbb37..542342e95a3f 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -7,7 +7,7 @@ ], "exclude": [ // test cases use a custom config file - "stubs*/@tests/test_cases" + "stubs/*/@tests/test_cases" ], "typeCheckingMode": "basic", "strictListInference": true, From a815adafafaf8599d35345f66bd756be8fd25f2a Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Wed, 1 Feb 2023 14:33:48 +0000 Subject: [PATCH 8/9] Try this --- pyrightconfig.json | 2 +- pyrightconfig.stricter.json | 2 +- pyrightconfig.testcases.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrightconfig.json b/pyrightconfig.json index 542342e95a3f..9fc8f5f5faa4 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -7,7 +7,7 @@ ], "exclude": [ // test cases use a custom config file - "stubs/*/@tests/test_cases" + "stubs/**/@tests/test_cases" ], "typeCheckingMode": "basic", "strictListInference": true, diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index 028f3be362ff..63c231e9dfe2 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -7,7 +7,7 @@ ], "exclude": [ // test cases use a custom pyrightconfig file - "stubs/*/@tests/test_cases" + "stubs/**/@tests/test_cases", "stdlib/distutils/command", "stdlib/lib2to3/refactor.pyi", "stdlib/_tkinter.pyi", diff --git a/pyrightconfig.testcases.json b/pyrightconfig.testcases.json index 0de5e5261792..13a7d8b37579 100644 --- a/pyrightconfig.testcases.json +++ b/pyrightconfig.testcases.json @@ -3,7 +3,7 @@ "typeshedPath": ".", "include": [ "test_cases", - "stubs/*/@tests/test_cases" + "stubs/**/@tests/test_cases" ], "typeCheckingMode": "strict", // Using unspecific "type ignore" comments in test_cases. From 2108507d0eb548eedcd873d613e8209adfd70fe2 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Wed, 1 Feb 2023 14:37:02 +0000 Subject: [PATCH 9/9] Make the order of the pyright steps more logical --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 19f8d571f023..6b83c400645b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -146,20 +146,20 @@ jobs: python-platform: ${{ matrix.python-platform }} python-version: ${{ matrix.python-version }} no-comments: ${{ matrix.python-version != '3.10' || matrix.python-platform != 'Linux' }} # Having each job create the same comment is too noisy. - project: ./pyrightconfig.stricter.json - uses: jakebailey/pyright-action@v1 with: version: ${{ steps.pyright_version.outputs.value }} python-platform: ${{ matrix.python-platform }} python-version: ${{ matrix.python-version }} no-comments: ${{ matrix.python-version != '3.10' || matrix.python-platform != 'Linux' }} # Having each job create the same comment is too noisy. - project: ./pyrightconfig.testcases.json + project: ./pyrightconfig.stricter.json - uses: jakebailey/pyright-action@v1 with: version: ${{ steps.pyright_version.outputs.value }} python-platform: ${{ matrix.python-platform }} python-version: ${{ matrix.python-version }} no-comments: ${{ matrix.python-version != '3.10' || matrix.python-platform != 'Linux' }} # Having each job create the same comment is too noisy. + project: ./pyrightconfig.testcases.json stub-uploader: name: Run the stub_uploader tests