test: refactor boot test
Use the unittest module from the standard library. Also, ensure that separate runs of this test don't share a osbuild store and clean up after themselves. With contributions from Ondřej Budai and Tom Gundersen.
This commit is contained in:
parent
83475cc9f4
commit
2ab9ba4e33
4 changed files with 54 additions and 10 deletions
21
test/osbuildtest.py
Normal file
21
test/osbuildtest.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
|
||||
class TestCase(unittest.TestCase):
|
||||
def run_osbuild(self, pipeline, store):
|
||||
osbuild_cmd = ["python3", "-m", "osbuild", "--json", "--store", store, "--libdir", ".", pipeline]
|
||||
|
||||
build_pipeline = os.getenv("OSBUILD_TEST_BUILD_PIPELINE", None)
|
||||
if build_pipeline:
|
||||
osbuild_cmd.append("--build-pipeline")
|
||||
osbuild_cmd.append(build_pipeline)
|
||||
|
||||
r = subprocess.run(osbuild_cmd, encoding="utf-8", stdout=subprocess.PIPE, check=True)
|
||||
|
||||
result = json.loads(r.stdout)
|
||||
return result["tree_id"], result["output_id"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue