osbuild: setup isort autochecking

The `test-src` makefile target now also runs isort against all source
files and reports errors.
This commit is contained in:
Simon de Vlieger 2022-08-17 11:23:19 +02:00
parent a5be1cc4d2
commit 98daf1a87d
3 changed files with 31 additions and 0 deletions

View file

@ -203,6 +203,23 @@ class TestBase(unittest.TestCase):
return r.returncode == 0 and "mypy" in r.stdout
def have_isort() -> bool:
"""Check isort Availability
This checks whether `isort` is available in the current path and
can be called by this process.
"""
try:
r = subprocess.run(
["isort", "--version"],
encoding="utf-8", stdout=subprocess.PIPE, check=False
)
except FileNotFoundError:
return False
return r.returncode == 0 and "isort" in r.stdout
@staticmethod
def have_rpm_ostree() -> bool:
"""Check rpm-ostree Availability