Files
qemu/python/tests/linters.py
John Snow 37826ad1db python: remove distutils workarounds
These are no longer necessary now that we are using Python3.12+.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260825215851.1780608-13-jsnow@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
2026-09-02 15:02:58 -04:00

110 lines
2.9 KiB
Python

# SPDX-License-Identifier: GPL-2.0-or-later
import os
from subprocess import check_call
import sys
class TestLinters:
def test_flake8_pkg(self):
check_call([sys.executable, "-m", "flake8", "qemu/"])
def test_flake8_scripts(self):
check_call([sys.executable, "-m", "flake8", "scripts/"])
def test_flake8_qapi(self):
check_call(
[
sys.executable,
"-m",
"flake8",
"../scripts/qapi/",
"../docs/sphinx/qapidoc.py",
"../docs/sphinx/qapi_domain.py",
]
)
def test_isort_minikconf(self):
check_call([sys.executable, "-m", "isort", "-c", "../scripts/minikconf.py"])
def test_isort_pkg(self):
check_call([sys.executable, "-m", "isort", "-c", "qemu/"])
def test_isort_scripts(self):
check_call([sys.executable, "-m", "isort", "-c", "scripts/"])
def test_isort_qapi(self):
check_call(
[
sys.executable,
"-m",
"isort",
"--sp",
".",
"-c",
"../scripts/qapi/",
]
)
def test_isort_qapi_sphinx(self):
# Force isort to recognize 'compat' as a local module and not
# third-party
check_call(
[
sys.executable,
"-m",
"isort",
"--sp",
".",
"-c",
"-p",
"compat",
"../docs/sphinx/qapi_domain.py",
"../docs/sphinx/qapidoc.py",
]
)
def test_mypy_minikconf(self):
check_call([sys.executable, "-m", "mypy", "../scripts/minikconf.py"])
def test_mypy_pkg(self):
check_call([sys.executable, "-m", "mypy", "-p", "qemu"])
def test_mypy_scripts(self):
check_call([sys.executable, "-m", "mypy", "scripts/"])
def test_mypy_qapi(self):
check_call([sys.executable, "-m", "mypy", "../scripts/qapi"])
def test_mypy_iotests(self):
check_call(
[sys.executable, "-m", "linters", "--mypy"],
cwd="../tests/qemu-iotests/",
)
def test_pylint_pkg(self):
check_call([sys.executable, "-m", "pylint", "qemu/"])
def test_pylint_scripts(self):
check_call([sys.executable, "-m", "pylint", "scripts/"])
def test_pylint_qapi(self):
check_call(
[
sys.executable,
"-m",
"pylint",
"--rcfile=../scripts/qapi/pylintrc",
"../scripts/qapi/",
"../docs/sphinx/qapidoc.py",
"../docs/sphinx/qapi_domain.py",
]
)
def test_pylint_iotests(self):
check_call(
[sys.executable, "-m", "linters", "--pylint"],
cwd="../tests/qemu-iotests/",
)