From 85cd3349458fe1c55d04fec7a23118698d2d15e1 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Wed, 1 Apr 2020 11:02:17 +0200 Subject: [PATCH] test/stages: narrow test detection via diff.json Only generate stage tests for sub-directories in stages_tests that contain a diff.json. This should allow us to have specialized stage tests that don't use the current {a, b}.json & diff.json pattern. --- test/run/test_stages.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/run/test_stages.py b/test/run/test_stages.py index 30020740..91de7671 100644 --- a/test/run/test_stages.py +++ b/test/run/test_stages.py @@ -3,6 +3,7 @@ # import difflib +import glob import json import os import pprint @@ -88,7 +89,7 @@ class TestStages(test.TestBase): def setUp(self): self.osbuild = test.OSBuild(self) - def run_stage_test(self, test_dir: str): + def run_stage_diff_test(self, test_dir: str): with self.osbuild as osb: def run(path): @@ -121,6 +122,8 @@ class TestStages(test.TestBase): def test_stages(self): path = os.path.join(self.locate_test_data(), "stages") - for name in os.listdir(path): - with self.subTest(stage=name): - self.run_stage_test(os.path.join(path, name)) + for t in glob.glob(f"{path}/*/diff.json"): + test_path = os.path.dirname(t) + test_name = os.path.basename(test_path) + with self.subTest(stage=test_name): + self.run_stage_diff_test(test_path)