[libvirt] [test-API PATCH 0/2] support variables share across testcases

Osier Yang jyang at redhat.com
Mon Apr 16 02:03:03 UTC 2012


On 2012年04月06日 17:53, Guannan Ren wrote:
>
> An example:
>
> #sharedvar.cfg
> domain:testa
>
> domain:testb
>
>
> #testa.py
> import sharedmod
>
> def testa(params):
> conn = sharedmod.conn
> logger = params['logger']

Given that the "connection" object is shared among
test cases now, why not "logger" object too?

> logger.info(conn.listNetworks())
> sharedmod.defined_var1 = "I am from testa"
> return 0
>
> #testb.py
> import sharedmod
>
> def testb(params):
> logger = params['logger']
> logger.info(sharedmod.conn.getURI())
> logger.info(sharedmod.defined_var1)
> return 0
>
>
> The output of 'python libvirt-test-api.py -c sharedvar.cfg
>
> Checking Testing Environment...
> Linux localhost.localdomain 3.2.5-3.fc16.x86_64 #1 SMP Thu Feb 9
> 01:24:38 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
> Virsh command line tool of libvirt: 0.9.10
> libvirtd (libvirt) 0.9.10
> default uri: qemu:///system
> QEMU emulator version 0.15.0 (qemu-kvm-0.15.0), Copyright (c) 2003-2008
> Fabrice Bellard
>
> Start Testing:
> Case Count: 2
> Log File: log/20120406174144/libvirt_test001
>
> domain:testa
> 17:41:44|INFO |['default']
> Result: OK
>
> domain:testb
> 17:41:44|INFO |qemu:///system
> 17:41:44|INFO |I am from testa
> Result: OK
>
> Summary:
> Total:2 [Pass:2 Fail:0]
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list