On 2012年04月16日 14:52, Martin Kletzander wrote:
> On 04/16/2012 04:43 AM, Osier Yang wrote:
>> On 2012年04月13日 23:44, Martin Kletzander wrote:
>>> Added cleanup function to the screeshot testcase. This makes use of
>>> the new "sharedmod" module.
>>> ---
>>>
>>> WARNING: don't push this before the patch with sharedmod is pushed in
>>> the repo, otherwise this will not work. Thanks.
>>>
>>> repos/domain/screenshot.py | 6 ++++++
>>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/repos/domain/screenshot.py b/repos/domain/screenshot.py
>>> index 3e727a7..5a12c4b 100644
>>> --- a/repos/domain/screenshot.py
>>> +++ b/repos/domain/screenshot.py
>>> @@ -6,6 +6,7 @@ import os
>>> import mimetypes
>>>
>>> import libvirt
>>> +import sharedmod
>>>
>>> required_params = ('guestname', 'filename',)
>>> optional_params = ('screen',)
>>> @@ -36,6 +37,7 @@ def screenshot(params):
>>> logger.debug('Mimetype of the file is %s' % mime)
>>>
>>> ret = st.finish()
>>> + sharedmod.dict['screenshot_filename'] = filename
>>
>> Is it neccessary to set a shared variable in the same case?
>> IIUC the purpose of sharemod.py, it's for variable sharing
>> among different test cases. Though the case will work fine,
>> but it's just redundant, and let's keep things simple.
>>
>> Osier
>>
>> --
>> libvir-list mailing list
>> libvir-list(a)redhat.com
>>
https://www.redhat.com/mailman/listinfo/libvir-list
>
> We can share just the extension if you want. I can also change it to
> share it in the module "global" variable. However, the parameter can be
> used by other tests this way, just in case.
I don't see any other test case will need the "screenshot_filename"
now, if we have some ones in future, change it to shared var at
that time then. The principle is not to put the parameter in shared
module if it's no need.
Osier