[elbe-devel] [PATCH 8/9] tests: test_cyclonedx_sbom: migrate to run_elbe_subcommand
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Thu Jul 25 11:47:18 CEST 2024
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/tests/cyclonedx/test_cyclonedx_sbom.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py b/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py
index 223eecaf63be..37df25b703c2 100644
--- a/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py
+++ b/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py
@@ -2,23 +2,26 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2020 Linutronix GmbH
+import contextlib
+import io
import json
import pathlib
import uuid
import jsonschema
-from elbepack.directories import run_elbe
+from elbepack.directories import run_elbe_subcommand
here = pathlib.Path(__file__).parent
def generate_test_bom():
source_dir = here.joinpath('build-simple-example')
- ps = run_elbe([
- 'cyclonedx-sbom', '-d', source_dir,
- ], check=True, capture_output=True)
- return json.loads(ps.stdout)
+ with contextlib.redirect_stdout(io.StringIO()) as stdout:
+ run_elbe_subcommand([
+ 'cyclonedx-sbom', '-d', source_dir,
+ ])
+ return json.loads(stdout.getvalue())
def test_schema():
--
2.45.2
More information about the elbe-devel
mailing list