Re: [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]

 




s/don't/Don't/

On 2012年04月24日 17:40, Guannan Ren wrote:
This a bug, if we define a testcase that use xml file such as

s/use/uses/

'storage:define_dir_pool' more than once, the pop action will
result in that the second call to the testcases fails to get

s/testcases/testcase/, s/fails/fail/

xml string in 'xmlstr = params['xml']'
Because the 'xml' element is poped out previously

Well, how about a compcat one:

Don't pop "xml" from the list, as it will still be used
afterwards.

---
  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

Honestly, I'm really disappointed with the filename. :-),

@@ -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():


ACK with the commit message either shortened, or fixed.

Osier

--
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]