debian-forge/test/integration_tests/build.py
Martin Sehnoutka ea68bb0c26 Test refactoring
The testing script is getting too big and not very well organized. In
this commit a new module `integration_tests` is introduced that contains
parts of the original testing script split into multiple files. The
content should be the same, the only difference is that now you can run
the tests by invoking `python3 -m test`.
2019-08-13 15:14:58 +02:00

25 lines
677 B
Python

import logging
import subprocess
import sys
from .config import *
def run_osbuild(pipeline: str, check=True):
cmd = OSBUILD + ["--store", OBJECTS, "-o", OUTPUT_DIR, pipeline]
logging.info(f"Running osbuild: {cmd}")
osbuild = subprocess.run(cmd, capture_output=True)
if osbuild.returncode != 0:
logging.error(f"{RED}osbuild failed!{RESET}")
print(f"{BOLD}STDERR{RESET}")
print(osbuild.stderr.decode())
print(f"{BOLD}STDOUT{RESET}")
print(osbuild.stdout.decode())
if check:
sys.exit(1)
return osbuild.returncode
def build_testing_image(pipeline_full_path):
run_osbuild(pipeline_full_path)