mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-11-26 21:09:42 +01:00
apply ruff lints
This commit is contained in:
parent
453896efd8
commit
e91914c6cc
1 changed files with 7 additions and 11 deletions
18
tests/run.py
18
tests/run.py
|
@ -8,7 +8,6 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Tuple
|
|
||||||
|
|
||||||
TEST_ROOT = Path(__file__).resolve().parent
|
TEST_ROOT = Path(__file__).resolve().parent
|
||||||
ROOT = TEST_ROOT.parent
|
ROOT = TEST_ROOT.parent
|
||||||
|
@ -18,9 +17,9 @@ RED = "\033[91m"
|
||||||
RESET = "\033[0m"
|
RESET = "\033[0m"
|
||||||
|
|
||||||
|
|
||||||
def parse_readme() -> List[str]:
|
def parse_readme() -> list[str]:
|
||||||
profiles = set()
|
profiles = set()
|
||||||
with open(ROOT.joinpath("README.md")) as f:
|
with ROOT.joinpath("README.md").open() as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
results = re.findall(r"<nixos-hardware/[^>]+>", line)
|
results = re.findall(r"<nixos-hardware/[^>]+>", line)
|
||||||
profiles.update(results)
|
profiles.update(results)
|
||||||
|
@ -29,7 +28,7 @@ def parse_readme() -> List[str]:
|
||||||
|
|
||||||
def build_profile(
|
def build_profile(
|
||||||
profile: str, verbose: bool
|
profile: str, verbose: bool
|
||||||
) -> Tuple[str, subprocess.CompletedProcess]:
|
) -> tuple[str, subprocess.CompletedProcess]:
|
||||||
# Hard-code this for now until we have enough other architectures to care about this.
|
# Hard-code this for now until we have enough other architectures to care about this.
|
||||||
system = "x86_64-linux"
|
system = "x86_64-linux"
|
||||||
if "raspberry-pi/2" in profile:
|
if "raspberry-pi/2" in profile:
|
||||||
|
@ -62,9 +61,9 @@ def build_profile(
|
||||||
res = subprocess.run(
|
res = subprocess.run(
|
||||||
cmd,
|
cmd,
|
||||||
cwd=TEST_ROOT,
|
cwd=TEST_ROOT,
|
||||||
stdout=subprocess.PIPE,
|
capture_output=True,
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
text=True,
|
text=True,
|
||||||
|
check=False,
|
||||||
)
|
)
|
||||||
return (profile, res)
|
return (profile, res)
|
||||||
|
|
||||||
|
@ -89,14 +88,11 @@ def parse_args() -> argparse.Namespace:
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
if len(args.profiles) == 0:
|
profiles = parse_readme() if len(args.profiles) == 0 else args.profiles
|
||||||
profiles = parse_readme()
|
|
||||||
else:
|
|
||||||
profiles = args.profiles
|
|
||||||
|
|
||||||
failed_profiles = []
|
failed_profiles = []
|
||||||
|
|
||||||
def eval_finished(args: Tuple[str, subprocess.CompletedProcess]) -> None:
|
def eval_finished(args: tuple[str, subprocess.CompletedProcess]) -> None:
|
||||||
profile, res = args
|
profile, res = args
|
||||||
if res.returncode == 0:
|
if res.returncode == 0:
|
||||||
print(f"{GREEN}OK {profile}{RESET}")
|
print(f"{GREEN}OK {profile}{RESET}")
|
||||||
|
|
Loading…
Reference in a new issue