[U-Boot] [PATCH] test/py: Fix exception, do not parametrize with empty set

Stefan Brüns stefan.bruens at rwth-aachen.de
Sun Oct 16 20:17:00 CEST 2016


If the parameter set is empty, the pytest setup fails:
---
    call: <CallInfo when='setup' exception: got empty parameter set
    ['env__dfu_config'], function test_dfu at [...]test_dfu.py:107>
---

This aborts pytest_runtest_makereport and later leads to an exception
during the report generation, as the call to log.start_section(...)
is never executed:
---
    Exception: Block nesting mismatch:
    "test_dfu[env__usb_dev_port0-env__dfu_config0]" ""
---

Signed-off-by: Stefan Brüns <stefan.bruens at rwth-aachen.de>
---
 test/py/conftest.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/py/conftest.py b/test/py/conftest.py
index 5b3a923..ebef40d 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -270,6 +270,8 @@ def generate_config(metafunc, fixture_name):
         # ... otherwise, see if there's a key that contains a list of
         # values to use instead.
         vals = subconfig.get(fixture_name+ 's', [])
+    if len(vals) == 0:
+        return
     def fixture_id(index, val):
         try:
             return val['fixture_id']
-- 
2.10.1



More information about the U-Boot mailing list