ni / nidaqmx-python

A Python API for interacting with NI-DAQmx
Other
413 stars 155 forks source link

CONTRIBUTING.md: Add info on running linters and simplify mypy invocation #612

Closed bkeryan closed 2 weeks ago

bkeryan commented 2 weeks ago

What does this Pull Request accomplish?

Add info on running linters to CONTRIBUTING.md.

Simplify mypy invocation by specifying files to check in pyproject.toml.

Fix bugs identified by running mypy once for the nidaqmx package and its tests.

tests\component\test_watchdog.py:10: error: "Task" not callable  [operator]
tests\component\test_watchdog.py:41: error: "Task" not callable  [operator]
tests\component\test_watchdog.py:67: error: "Task" not callable  [operator]
tests\unit\test_lib_time.py:109: error: Argument "tzinfo" to "to_datetime" of "AbsoluteTime" has incompatible type "ZoneInfo"; expected "Optional[timezone]"  [arg-type]
tests\unit\test_grpc_time.py:132: error: Argument "tzinfo" to "convert_timestamp_to_time" has incompatible type "ZoneInfo"; expected "Optional[timezone]"  [arg-type]
tests\component\test_interpreter.py:45: error: Invalid index type "int" for "dict[DAQmxErrors, str]"; expected type "DAQmxErrors"  [index]
tests\component\task\test_in_stream_read_properties.py:139: error: Incompatible types in assignment (expression has type "str", variable has type "Optional[Path]")  [assignment]
tests\component\task\test_in_stream_read_properties.py:159: error: Incompatible types in assignment (expression has type "str", variable has type "Optional[Path]")  [assignment]
tests\component\task\channels\test_channel_properties.py:216: error: "Scale" has no attribute "load"  [attr-defined]
tests\acceptance\test_multi_threading.py:126: error: Argument 4 to "submit" of "Executor" has incompatible type "Task"; expected "AIChannel"  [arg-type]
tests\acceptance\test_multi_threading.py:135: error: Argument 4 to "submit" of "Executor" has incompatible type "Task"; expected "AIChannel"  [arg-type]
tests\acceptance\test_internationalization.py:69: error: Incompatible types in assignment (expression has type "str", variable has type "Optional[Path]")  [assignment]
tests\unit\test_task_events.py:40: error: Argument 3 to "register_event_handlers" has incompatible type "type[_TaskEventType]"; expected "Sequence[_TaskEventType]"  [arg-type]
tests\unit\test_task_events.py:56: error: Argument 3 to "register_event_handlers" has incompatible type "type[_TaskEventType]"; expected "Sequence[_TaskEventType]"  [arg-type]
tests\unit\test_task_events.py:71: error: Argument 3 to "register_event_handlers" has incompatible type "type[_TaskEventType]"; expected "Sequence[_TaskEventType]"  [arg-type]
tests\unit\test_task.py:46: error: "Callable[[Optional[GrpcSessionOptions], Optional[BaseInterpreter]], BaseInterpreter]" has no attribute "mock"  [attr-defined]

Why should this Pull Request be merged?

Help developers catch linter issues before the PR build runs.

Make it easier to run mypy.

What testing has been done?

Ran poetry run mypy and poetry run pytest -v.

github-actions[bot] commented 2 weeks ago

Test Results

    34 files  ±0      34 suites  ±0   47m 46s :stopwatch: + 1m 10s  2 320 tests ±0   1 954 :white_check_mark: ±0    366 :zzz: ±0  0 :x: ±0  41 110 runs  ±0  34 882 :white_check_mark: ±0  6 228 :zzz: ±0  0 :x: ±0 

Results for commit 78a46fb5. ± Comparison against base commit 570c62b4.

:recycle: This comment has been updated with latest results.