[test-API PATCH 2/4] don't pop out element from optional_params

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This a bug, if we define a testcase that use xml file such as
'storage:define_dir_pool' more than once, the pop action will
result in that the second call to the testcases fails to get
xml string in 'xmlstr = params['xml']'
Because the 'xml' element is poped out previously
---
 src/testcasexml.py |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/src/testcasexml.py b/src/testcasexml.py
index 742116b..8485d3d 100644
--- a/src/testcasexml.py
+++ b/src/testcasexml.py
@@ -7,13 +7,12 @@ def xml_file_to_str(proxy_obj, mod_case, case_params):
     """ get xml string from xml file in case_params
         return a new case_params with the string in it
     """
-
     optional_params = proxy_obj.get_testcase_params(mod_case)[1]
 
     if case_params.has_key('xml'):
         file_name = case_params.pop('xml')
     elif optional_params.has_key('xml'):
-        file_name = optional_params.pop('xml')
+        file_name = optional_params['xml']
     else:
         return None
 
@@ -34,8 +33,6 @@ def xml_file_to_str(proxy_obj, mod_case, case_params):
     else:
         raise exception.FileDoesNotExist("xml file %s doesn't exist" % xml_file_path)
 
-    optional_params = proxy_obj.get_testcase_params(mod_case)[1]
-
     # replace the params that in testcase.conf first
     for (key, value) in case_params.items():
 
-- 
1.7.7.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]