tools/koji-compose.py: test with pylint and fix found issues
Check `tools/koji-compose.py` using pylint as part of GitHub actions. Fix all issues that were found by pylint.
This commit is contained in:
parent
7c73861c22
commit
31b1a383f0
2 changed files with 10 additions and 5 deletions
4
.github/workflows/tests.yml
vendored
4
.github/workflows/tests.yml
vendored
|
|
@ -88,7 +88,7 @@ jobs:
|
|||
steps:
|
||||
|
||||
- name: Install build and test dependencies
|
||||
run: dnf -y install python3-pylint git-core
|
||||
run: dnf -y install python3-pylint git-core python3-requests
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
|
|
@ -97,7 +97,7 @@ jobs:
|
|||
|
||||
- name: Analysing the code with pylint
|
||||
run: |
|
||||
python3 -m pylint dnf-json
|
||||
python3 -m pylint dnf-json tools/koji-compose.py
|
||||
|
||||
lint:
|
||||
name: "⌨ Lint"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/python3
|
||||
# pylint: disable=invalid-name
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
|
|
@ -200,15 +202,18 @@ def main():
|
|||
sys.exit(1)
|
||||
status = r.json()["status"]
|
||||
print(status, file=sys.stderr)
|
||||
|
||||
if status == "success":
|
||||
print("Compose worked!", file=sys.stderr)
|
||||
print(r.text, file=sys.stderr)
|
||||
break
|
||||
elif status == "failure":
|
||||
|
||||
if status == "failure":
|
||||
print("compose failed!", file=sys.stderr)
|
||||
print(r.text, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
elif status != "pending" and status != "running":
|
||||
|
||||
if status not in ("pending", "running"):
|
||||
print(f"unexpected status: {status}", file=sys.stderr)
|
||||
print(r.text, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
|
@ -218,7 +223,7 @@ def main():
|
|||
r = composer_api_client.compose_log(compose_id)
|
||||
logs = r.json()
|
||||
assert "image_builds" in logs
|
||||
assert type(logs["image_builds"]) == list
|
||||
assert isinstance(logs["image_builds"], list)
|
||||
assert len(logs["image_builds"]) == len(cr["image_requests"])
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue