Skip to contentSkip to conversation

classes/testimage: Fix exportTests function.

PATCH In review Aníbal Limón 2 participants 3 messages Feb 2, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 21/21 classes/testimage: Fix exportTests function.

With new structure of TestContext now holds suite and variable that contains unittest instances, it can't be exported using JSON causing and exception.

Adds the suite variable for avoid export it.

---
 meta/classes/testimage.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/testimage.bbclass +1 -1
index 5fafda1..57858e6 100644
@@ -112,7 +112,7 @@ def exportTests(d,tc):
     savedata["host_dumper"] = {}
     for key in tc.__dict__:
         # special cases
-        if key != "d" and key != "target" and key != "host_dumper":
+        if key != "d" and key != "target" and key != "host_dumper" and key != "suite":
             savedata[key] = getattr(tc, key)
     savedata["target"]["ip"] = tc.target.ip or d.getVar("TEST_TARGET_IP", True)
     savedata["target"]["server_ip"] = tc.target.server_ip or d.getVar("TEST_SERVER_IP", True)
Signature · 1 line
2.1.4
#2 lore raw
Quoted 16 lines · On Tue, 02 Feb 2016 12:09:37 Aníbal Limón wrote:

With new structure of TestContext now holds suite and variable that contains unittest instances, it can't be exported using JSON causing and exception.

Adds the suite variable for avoid export it.

---
 meta/classes/testimage.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/testimage.bbclass +0 -0
index 5fafda1..57858e6 100644

meta/classes/testimage.bbclass def exportTests(d,tc): · line 116

Quoted 6 lines
meta/classes/testimage.bbclass +1 -1
@@ -112,7 +112,7 @@ def exportTests(d,tc):
     savedata["host_dumper"] = {}
     for key in tc.__dict__:
         # special cases
-        if key != "d" and key != "target" and key != "host_dumper":
+        if key != "d" and key != "target" and key != "host_dumper" and key
 != "suite": savedata[key] = getattr(tc, key)

Given how long this is getting we might want to change to:

if key not in ['d', 'target', 'host_dumper', 'suite']:

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#3 lore raw
Quoted 26 lines · Paul Eggleton
Quoted 16 lines · On Tue, 02 Feb 2016 12:09:37 Aníbal Limón wrote:

With new structure of TestContext now holds suite and variable that contains unittest instances, it can't be exported using JSON causing and exception.

Adds the suite variable for avoid export it.

---
 meta/classes/testimage.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/testimage.bbclass +0 -0
index 5fafda1..57858e6 100644

meta/classes/testimage.bbclass def exportTests(d,tc): · line 116

Quoted 6 lines
meta/classes/testimage.bbclass +1 -1
@@ -112,7 +112,7 @@ def exportTests(d,tc):
     savedata["host_dumper"] = {}
     for key in tc.__dict__:
         # special cases
-        if key != "d" and key != "target" and key != "host_dumper":
+        if key != "d" and key != "target" and key != "host_dumper" and key
 != "suite": savedata[key] = getattr(tc, key)

Given how long this is getting we might want to change to:

Quoted 1 line

if key not in ['d', 'target', 'host_dumper', 'suite']:

Good one...

Quoted 4 lines

Cheers,
Paul