An example:
#sharedvar.cfg
domain:testa
domain:testb
#testa.py
import sharedmod
def testa(params):
conn = sharedmod.conn
logger = params['logger']
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]