On 04/06/2012 11:14 AM, Guannan Ren wrote: > sharedmod.py: in root directory > --- > sharedmod.py | 13 +++++++++++++ > 1 files changed, 13 insertions(+), 0 deletions(-) > create mode 100644 sharedmod.py > > diff --git a/sharedmod.py b/sharedmod.py > new file mode 100644 > index 0000000..f3de5a6 > --- /dev/null > +++ b/sharedmod.py > @@ -0,0 +1,13 @@ > +# This is a module for variable sharing across testcases during > +# running. You have to import it in each of testcases which want > +# to share data. The framwork have already set 'conn' for use in > +# testcases. > + > +# connection object in libvirt.py > +conn = None > + > +# shared variables for customized use in testcases > +# Note: please set them to None at the end of sharing > +defined_var1 = None > +defined_var2 = None > +defined_var3 = None I see this could be little more error-prone. And maybe little more variable. I know we can add a variable for every test making use of some sharemod persistence, but that would mean there will be big mess very early. I would probably just do something like this for example: data = {} And then in the test when you want to use shared variable, you can do: Setting: sharedmod.data['my_test_variable'] = 'test_value' Checking: if sharedmod.data.has_key('my_test_valiable'): # The value is set Getting: sharemod.data.get('my_test_variable', 'test_variable_default_value') But if the current suits you better, I think you can go with it as well. Martin -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list