The tests config is created by parsing the testrun config
earlier in the DTS execution than when the smoke_tests
testsuite is added. This situation causes a key error
on the tests_config dictionary when smoke_tests is enabled.
This commit creates a placeholder TestSuiteConfig for
smoke tests in the function which is responsible for
creating the tests config model, resolving the issue.
Fixes: 184d21f08db4 ("dts: add per-test-suite configuration")
Signed-off-by: Patrick Robb <[email protected]>
Reviewed-by: Luca Vizzarro <[email protected]>
---
dts/framework/config/test_run.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dts/framework/config/test_run.py b/dts/framework/config/test_run.py
index 06fe28143c..b6e4099eeb 100644
--- a/dts/framework/config/test_run.py
+++ b/dts/framework/config/test_run.py
@@ -301,11 +301,14 @@ def make_test_suite_config_field(config_obj:
type["BaseConfig"]):
return config_obj, Field(default_factory=config_obj)
-def create_test_suites_config_model(test_suites: Iterable[TestSuiteConfig]) ->
type[BaseModel]:
+def create_test_suites_config_model(test_suites: list[TestSuiteConfig]) ->
type[BaseModel]:
"""Create model for the test suites configuration."""
+ complete_test_suites = [TestSuiteConfig(test_suite="smoke_tests")]
+ complete_test_suites += test_suites
+
test_suites_kwargs = {
t.test_suite_name:
make_test_suite_config_field(t.test_suite_spec.config_obj)
- for t in test_suites
+ for t in complete_test_suites
}
return create_model("TestSuitesConfiguration", **test_suites_kwargs)
--
2.48.1