diff mbox

[virt-test,2/7] virt: Update cartesian config unittest

Message ID 1364577250-2637-3-git-send-email-jzupka@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jiri Zupka March 29, 2013, 5:14 p.m. UTC
Signed-off-by: Ji?í Župka <jzupka@redhat.com>
---
 virttest/cartesian_config_unittest.py | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)
diff mbox

Patch

diff --git a/virttest/cartesian_config_unittest.py b/virttest/cartesian_config_unittest.py
index c72cb71..afc1b14 100755
--- a/virttest/cartesian_config_unittest.py
+++ b/virttest/cartesian_config_unittest.py
@@ -1,4 +1,3 @@ 
-#!/usr/bin/python
 import unittest, logging, os
 import gzip
 import cartesian_config
@@ -38,13 +37,11 @@  class CartesianConfigTest(unittest.TestCase):
         self._checkDictionaries(p, reference)
 
 
-    def _checkStringDump(self, string, dump):
-        p = cartesian_config.Parser()
+    def _checkStringDump(self, string, dump, defaults=False):
+        p = cartesian_config.Parser(defaults=defaults)
         p.parse_string(string)
 
-        dumpdata = None
-        exec "dumpdata = " + dump
-        self._checkDictionaries(p, dumpdata)
+        self._checkDictionaries(p, dump)
 
 
     def testSimpleVariant(self):
@@ -75,17 +72,18 @@  class CartesianConfigTest(unittest.TestCase):
                         no unknown_qemu
                 - testB:
             """,
-            """[
-{'dep': [],
- 'name': 'testA.kvm.unknown_qemu',
- 'shortname': 'testA.kvm.unknown_qemu'},
-{'dep': [],
- 'name': 'testB.kvm.unknown_qemu',
- 'shortname': 'testB.kvm.unknown_qemu'},
-{'dep': [],
- 'name': 'testB.nokvm.unknown_qemu',
- 'shortname': 'testB.nokvm.unknown_qemu'},
-]""")
+            [
+                {'dep': [],
+                 'name': 'testA.kvm.unknown_qemu',
+                 'shortname': 'testA.kvm.unknown_qemu'},
+                {'dep': [],
+                 'name': 'testB.kvm.unknown_qemu',
+                 'shortname': 'testB.kvm.unknown_qemu'},
+                {'dep': [],
+                 'name': 'testB.nokvm.unknown_qemu',
+                 'shortname': 'testB.nokvm.unknown_qemu'},
+            ]
+            )
 
 
     def testHugeTest1(self):