[Libvirt-cim] [PATCH] [TEST] Update libraries present to follow the new coding style

Guo Lian Yun yunguol at cn.ibm.com
Thu Feb 12 05:15:07 UTC 2009


libvirt-cim-bounces at redhat.com wrote on 2009-02-12 03:13:46:

> 
> > diff -r 1bb347c22e6e -r dd59a8d6a123 suites/libvirt-
> cim/lib/XenKvmLib/const.py
> > --- a/suites/libvirt-cim/lib/XenKvmLib/const.py   Mon Feb 09 21:
> 47:35 2009 -0800
> > +++ b/suites/libvirt-cim/lib/XenKvmLib/const.py   Wed Feb 11 00:
> 10:44 2009 -0800
> > @@ -140,8 +140,8 @@
> >                      destroy_and_undefine_all(options.ip, 
options.virt)
> >                      rc = f()
> >                  except Exception, e:
> > -                    logger.error('%s : %s' % (e.__class__.__name__, 
e))
> > -                    logger.error("%s" % traceback.print_exc())
> > +                    logger.error('%s : %s', e.__class__.__name__, e)
> > +                    logger.error("%s", traceback.print_exc())
> >                      rc = FAIL
> >                  return rc
> >              setattr(do_try, 'options', options)
> > diff -r 1bb347c22e6e -r dd59a8d6a123 suites/libvirt-
> cim/lib/XenKvmLib/test_xml.py
> > --- a/suites/libvirt-cim/lib/XenKvmLib/test_xml.py   Mon Feb 09 
> 21:47:35 2009 -0800
> > +++ b/suites/libvirt-cim/lib/XenKvmLib/test_xml.py   Wed Feb 11 
> 00:10:44 2009 -0800
> > @@ -48,7 +48,8 @@
> >  def testxml(test_dom="domU1", mem = 128, vcpus = 1, mac = 
default_mac, \
> >   disk_file_path = disk_path, disk = "xvda"):
> >      if not (os.path.exists(kernel_path) and 
os.path.exists(init_path)) :
> > -        logger.error("ERROR: Either the kernel image or the 
> init_path does not exist")
> > +        logger.error("ERROR: Either the kernel image or the \
> > +                     init_path does not exist")
> 
> Can you do the following instead (otherwise extra whitespace will be 
> displayed when the line is printed):
> 
> logger.error("ERROR: Either the kernel image or the"
>               "init_path does not exist")
> 
> >          sys.exit(SKIP)
> >      test_xml = """
> >      <domain type='xen' id='23'>
> > @@ -76,8 +77,8 @@
> >          </disk>
> >        </devices>
> >      </domain>
> > -    """ % ( test_dom, set_uuid(), kernel_path, init_path, 
> mem*1024, vcpus, mac, \
> > -                                                disk_file_path, disk 
)
> > +    """ % ( test_dom, set_uuid(), kernel_path, init_path, 
> mem*1024, vcpus, \
> 
> No need for the \ here.
> 
> > +            mac, disk_file_path, disk )
> >      return test_xml
> > 
> >  def testxml_bl(test_dom="domU1", mem = 128, vcpus = 1, mac = 
default_mac, \
> > @@ -88,7 +89,8 @@
> >  specify either localhost or remote machine ip/name " )
> >          sys.exit(SKIP)
> >      if not (os.path.exists(kernel_path) and 
os.path.exists(init_path)) :
> > -        logger.error("ERROR: Either the kernel image or the 
> init_path does not exist")
> > +        logger.error("ERROR: Either the kernel image or the \
> > +                     init_path does not exist")
> 
> 
> Can you do the following instead (otherwise extra whitespace will be 
> displayed when the line is printed):
> 
> logger.error("ERROR: Either the kernel image or the"
>               "init_path does not exist")
> 
> >          sys.exit(SKIP)
> >      test_xml = """
> >      <domain type='xen' id='23'>
> > @@ -125,7 +127,8 @@
> >              mac = default_mac, disk_file_path = disk_path,
> >              disk = "xvda", server = ""): 
> >      if not (os.path.exists(kernel_path) and 
os.path.exists(init_path)) :
> > -        logger.error("ERROR: Either the kernel image or the 
> init_path does not exist")
> > +        logger.error("ERROR: Either the kernel image or the \
> > +                     init_path does not exist")
> 
> Same here.
> 
> >          sys.exit(SKIP)
> >      vir_network = net_list(server)
> >      if len(vir_network) > 0 :
> > @@ -140,7 +143,8 @@
> >          net_xml, bridge = netxml(server, bridgename, networkname)
> >          ret = create_vnet(server, net_xml)
> >          if not ret:
> > -            logger.error("Failed to create the Virtual Network '%
> s'", networkname)
> > +            logger.error("Failed to create the Virtual Network '%s'", 

> > +                         networkname)
> >              sys.exit(SKIP)
> > 
> >      test_xml = """
> > @@ -179,7 +183,8 @@
> >      if bridgename in bridges:
> >          bridge_name = bridgename + str(random.randint(1, 100))
> >          if bridge_name in bridges:
> > -            logger.error("Need to give different bridge name 
> since it alreay exists")
> > +            logger.error("Need to give different bridge name since \
> > +                         it alreay exists")
> 
> Same here.
> 

   Fixed all of them on #2 patch.
   Thanks!

> -- 
> Kaitlin Rupert
> IBM Linux Technology Center
> kaitlin at linux.vnet.ibm.com
> 
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20090212/2af589b8/attachment.htm>


More information about the Libvirt-cim mailing list