GitLab: https://gitlab.com/jsnow/qemu/-/commits/python-package-iotest-pt2 CI: https://gitlab.com/jsnow/qemu/-/pipelines/388626603
(There's no real rush on my part for this particular series, so review at-leisure, I'm just getting my edits back out onto the list. The AQMP series is more important to me in the short-term. I suppose this would be good to have prior to the RC testing phase, though.) Factor out pylint and mypy configuration from iotest 297 so that the Python test infrastructure in python/ can also run these linters. This will enable what is essentially iotest #297 to run via GitLab CI, via the 'check-python-pipenv' and 'check-python-tox' tests with new 'iotests-pylint' and 'iotests-mypy' cases. This series generally aims to split "linter configuration" out of code so that both iotest #297 and the Python test suite can both invoke the same linters (nearly) identically. iotest #297 is left as a valid way to run these tests as a convenience for block layer developers until I can integrate environment setup and test execution as a part of 'make check' or similar to serve as a replacement. This invocation (at present) just trusts you've installed the right packages into the right places with the right versions, as it always has. Future patches may begin to build the Python testing environment as part of 'make check', but there are some details to hammer out there, first. v5: Broadly: - Remove int return from linting helpers - Tighten tool availability checks - Explicitly ensured no regressions on 297 mid-series In detail: 001/15:[----] [--] 'iotests/297: Move pylint config into pylintrc' 002/15:[----] [--] 'iotests/297: Split mypy configuration out into mypy.ini' 003/15:[----] [--] 'iotests/297: Add get_files() function' 004/15:[----] [--] 'iotests/297: Create main() function' 005/15:[0002] [FC] 'iotests/297: Don't rely on distro-specific linter binaries' 006/15:[0023] [FC] 'iotests/297: Split run_linters apart into run_pylint and run_mypy' 007/15:[0006] [FC] 'iotests/297: refactor run_[mypy|pylint] as generic execution shim' 008/15:[down] 'iotests/297: Change run_linter() to raise an exception on failure' 009/15:[down] 'iotests/297: update tool availability checks' 010/15:[down] 'iotests/297: split test into sub-cases' 011/15:[0051] [FC] 'iotests: split linters.py out from 297' 012/15:[0021] [FC] 'iotests/linters: Add entry point for linting via Python CI' 013/15:[0004] [FC] 'iotests/linters: Add workaround for mypy bug #9852' 014/15:[----] [--] 'python: Add iotest linters to test suite' 015/15:[0072] [FC] 'iotests: [RFC] drop iotest 297' - 005: Fixed extra parenthesis. (Oops.) - 006: Squashed with intermediate patch from v1. - 007: Removed 'int' return from run_linter() - 008-010: New. - 011: Modified comment, otherwise just rebased. - 012: Rewrote CLI handling to be more thorough. - 013: Rebase changes only. - 015: Rebase changes, not that it matters! v4: - Some optimizations and touchups were included in 'PATCH v2 0/6] iotests: update environment and linting configuration' instead, upon which this series is now based. - Rewrote most patches, being more aggressive about the factoring between "iotest" and "linter invocation". The patches are smaller now. - Almost all configuration is split out into mypy.ini and pylintrc. - Remove the PWD/CWD juggling that the previous versions added; it's not strictly needed for this integration. We can re-add it later if we wind up needing it for something. - mypy and pylintrc tests are split into separate tests. The GitLab CI now lists them as two separate test cases, so it's easier to see what is failing and why. (And how long those tests take.) It is also now therefore possible to ask avocado to run just one or the other. - mypy bug workaround is only applied strictly in cases where it is needed, optimizing speed of iotest 297. v3: - Added patch 1 which has been submitted separately upstream, but was necessary for testing. - Rebased on top of hreitz/block, which fixed some linting issues. - Added a workaround for a rather nasty mypy bug ... >:( v2: - Added patches 1-5 which do some more delinting. - Added patch 8, which scans subdirs for tests to lint. - Added patch 17, which improves the speed of mypy analysis. - Patch 14 is different because of the new patch 8. John Snow (15): iotests/297: Move pylint config into pylintrc iotests/297: Split mypy configuration out into mypy.ini iotests/297: Add get_files() function iotests/297: Create main() function iotests/297: Don't rely on distro-specific linter binaries iotests/297: Split run_linters apart into run_pylint and run_mypy iotests/297: refactor run_[mypy|pylint] as generic execution shim iotests/297: Change run_linter() to raise an exception on failure iotests/297: update tool availability checks iotests/297: split test into sub-cases iotests: split linters.py out from 297 iotests/linters: Add entry point for linting via Python CI iotests/linters: Add workaround for mypy bug #9852 python: Add iotest linters to test suite iotests: [RFC] drop iotest 297 python/tests/iotests-mypy.sh | 4 ++ python/tests/iotests-pylint.sh | 4 ++ tests/qemu-iotests/297.out | 2 - tests/qemu-iotests/{297 => linters.py} | 96 ++++++++++++-------------- tests/qemu-iotests/mypy.ini | 12 ++++ tests/qemu-iotests/pylintrc | 16 +++++ 6 files changed, 79 insertions(+), 55 deletions(-) create mode 100755 python/tests/iotests-mypy.sh create mode 100755 python/tests/iotests-pylint.sh delete mode 100644 tests/qemu-iotests/297.out rename tests/qemu-iotests/{297 => linters.py} (52%) mode change 100755 => 100644 create mode 100644 tests/qemu-iotests/mypy.ini -- 2.31.1