linux-stable/tools/testing/kunit
Daniel Latypov 86daf6b55a kunit: tool: undo type subscripts for subprocess.Popen
[ Upstream commit e30f65c4b3 ]

Writing `subprocess.Popen[str]` requires python 3.9+.
kunit.py has an assertion that the python version is 3.7+, so we should
try to stay backwards compatible.

This conflicts a bit with commit 1da2e6220e ("kunit: tool: fix
pre-existing `mypy --strict` errors and update run_checks.py"), since
mypy complains like so
> kunit_kernel.py:95: error: Missing type parameters for generic type "Popen"  [type-arg]

Note: `mypy --strict --python-version 3.7` does not work.

We could annotate each file with comments like
  `# mypy: disable-error-code="type-arg"
but then we might still get nudged to break back-compat in other files.

This patch adds a `mypy.ini` file since it seems like the only way to
disable specific error codes for all our files.

Note: run_checks.py doesn't need to specify `--config_file mypy.ini`,
but I think being explicit is better, particularly since most kernel
devs won't be familiar with how mypy works.

Fixes: 695e260308 ("kunit: tool: add subscripts for type annotations where appropriate")
Reported-by: SeongJae Park <sj@kernel.org>
Link: https://lore.kernel.org/linux-kselftest/20230501171520.138753-1-sj@kernel.org
Signed-off-by: Daniel Latypov <dlatypov@google.com>
Tested-by: SeongJae Park <sj@kernel.org>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-19 16:35:17 +02:00
..
configs kunit: tool: rename all_test_uml.config, use it for --alltests 2022-09-30 13:22:55 -06:00
qemu_configs kunit: tool: Add support for SH under QEMU 2023-04-05 12:51:16 -06:00
test_data kunit: tool: parse KTAP compliant test output 2022-12-12 14:13:47 -07:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
kunit.py kunit: tool: fix pre-existing mypy --strict errors and update run_checks.py 2023-03-17 12:28:30 -06:00
kunit_config.py kunit: tool: fix pre-existing mypy --strict errors and update run_checks.py 2023-03-17 12:28:30 -06:00
kunit_json.py kunit: tool: misc cleanups 2022-05-16 13:22:36 -06:00
kunit_kernel.py kunit: tool: undo type subscripts for subprocess.Popen 2023-07-19 16:35:17 +02:00
kunit_parser.py kunit: tool: remove unused imports and variables 2023-03-17 12:28:25 -06:00
kunit_printer.py kunit: tool: add subscripts for type annotations where appropriate 2023-03-17 12:28:18 -06:00
kunit_tool_test.py kunit: tool: remove unused imports and variables 2023-03-17 12:28:25 -06:00
mypy.ini kunit: tool: undo type subscripts for subprocess.Popen 2023-07-19 16:35:17 +02:00
qemu_config.py kunit: tool: Add support for overriding the QEMU serial port 2023-04-05 12:51:06 -06:00
run_checks.py kunit: tool: undo type subscripts for subprocess.Popen 2023-07-19 16:35:17 +02:00