-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Fix mypy errors and run mypy during PR build (#505)
* mypy: Update missing imports * tests: Fix mypy errors in _grpc_utils.py * tests: Fix mypy errors in conftest.py tests\conftest.py:56: error: Variable "pytest.ParameterSet" is not valid as a type [valid-type] tests\conftest.py:56: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases tests\conftest.py:280: error: Bracketed expression "[...]" is not valid as a type [valid-type] tests\conftest.py:280: note: Did you mean "List[...]"? * tests: Fix mypy errors in _grpc_utils.py tests\unit\_grpc_utils.py:10: error: Incompatible types in assignment (expression has type "None", variable has type Module) [assignment] tests/_grpc_utils.py:24: error: Item "None" of "IO[bytes] | None" has no attribute "readline" [union-attr] tests/_grpc_utils.py:57: error: Module has no attribute "ConnectRegistry" [attr-defined] tests/_grpc_utils.py:57: error: Module has no attribute "HKEY_LOCAL_MACHINE" [attr-defined] tests/_grpc_utils.py:58: error: Module has no attribute "KEY_READ" [attr-defined] tests/_grpc_utils.py:58: error: Module has no attribute "KEY_WOW64_64KEY" [attr-defined] tests/_grpc_utils.py:59: error: Module has no attribute "OpenKey" [attr-defined] tests/_grpc_utils.py:62: error: Module has no attribute "QueryValueEx" [attr-defined] * tests: Fix mypy errors in test_grpc_time.py tests\unit\test_grpc_time.py:18: error: Cannot assign to a type [misc] tests\unit\test_grpc_time.py:18: error: Incompatible types in assignment (expression has type "None", variable has type "type[Timestamp]") [assignment] * tests: Fix mypy errors for test_utils.py tests\legacy\test_utils.py:28: error: Need type annotation for "unflattened_channels" (hint: "unflattened_channels: List[<type>] = ...") [var-annotated] * tests: Fix mypy errors in test_invalid_writes.py tests\legacy\test_invalid_writes.py:58: error: Argument 1 to "floating" has incompatible type "list[float]"; expected "Union[None, Union[str, bytes], SupportsFloat, SupportsIndex]" [arg-type] tests\legacy\test_invalid_writes.py:109: error: Argument 1 to "floating" has incompatible type "list[list[float]]"; expected "Union[None, Union[str, bytes], SupportsFloat, SupportsIndex]" [arg-type] tests\legacy\test_invalid_writes.py:136: error: Argument 1 to "floating" has incompatible type "list[list[float]]"; expected "Union[None, Union[str, bytes], SupportsFloat, SupportsIndex]" [arg-type] * tests: Fix mypy errors in test_task_events.py tests\component\test_task_events.py:526: error: Value of type "Union[tuple[type[BaseException], BaseException, Optional[TracebackType]], tuple[None, None, None], None]" is not indexable [index] tests\component\test_task_events.py:526: error: Argument 1 to "_exception_matches" has incompatible type "Union[BaseException, None, Any]"; expected "Exception" [arg-type] tests\component\test_task_events.py:530: error: Value of type "Union[tuple[type[BaseException], BaseException, Optional[TracebackType]], tuple[None, None, None], None]" is not indexable [index] ption, None, Any]"; expected "Exception" [arg-type] * tests: Fix mypy errors in test_examples.py tests\acceptance\test_examples.py:38: error: Incompatible types in assignment (expression has type "nullcontext[None]", variable has type "catch_warnings[list[WarningMessage]]") [assignment] * tests: Fix mypy errors in test_stream_readers_ci.py tests\component\test_stream_readers_ci.py:180: error: Argument 1 to "_validate_frequency_data" has incompatible type "ndarray[Any, dtype[floating[_64Bit]]]"; expected "ndarray[Any, dtype[unsignedinteger[_32Bit]]]" [arg-type] * tests: Fix mypy errors in test_stream_readers_di.py tests\component\test_stream_readers_di.py:186: error: Type argument "_DType" of "NDArray" must be a subtype of "generic" [type-var] * GitHub: Update build.yml to run mypy on tests and install extras * mypy: Copy more options from the NI Python template * tests: Fix unreachable code in conftest.py tests\conftest.py:119: error: Statement is unreachable [unreachable] tests\conftest.py:140: error: Statement is unreachable [unreachable] tests\conftest.py:178: error: Statement is unreachable [unreachable] tests\conftest.py:197: error: Statement is unreachable [unreachable] tests\conftest.py:216: error: Statement is unreachable [unreachable] tests\conftest.py:238: error: Statement is unreachable [unreachable] tests\conftest.py:302: error: Statement is unreachable [unreachable] tests\conftest.py:318: error: Statement is unreachable [unreachable] tests\conftest.py:433: error: Statement is unreachable [unreachable] tests\conftest.py:447: error: Statement is unreachable [unreachable] tests\conftest.py:463: error: Statement is unreachable [unreachable]
- Loading branch information
Showing
13 changed files
with
74 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters