virttest/funcatexit: Change func.__globals__ to func.func_globals, as python 2.4 do not support it.
We found following error in python 2.4.
Traceback (most recent call last):
File "/usr/code/autotest-devel/client/shared/test.py", line 426, in _exec
_call_test_function(self.execute, *p_args, **p_dargs)
File "/usr/code/autotest-devel/client/shared/test.py", line 853, in _call_test_function
raise error.UnhandledTestFail(e)
UnhandledTestFail: Unhandled AttributeError: 'function' object has no attribute '__globals__' [context: (run_unattended_install)]
Traceback (most recent call last):
File "/usr/code/autotest-devel/client/shared/test.py", line 846, in _call_test_function
return func(*args, **dargs)
File "/usr/code/autotest-devel/client/shared/test.py", line 299, in execute
postprocess_profiled_run, args, dargs)
File "/usr/code/autotest-devel/client/shared/test.py", line 215, in _call_run_once
self.run_once_profiling(postprocess_profiled_run,
File "/usr/code/autotest-devel/client/shared/test.py", line 322, in run_once_profiling
self.run_once(*args, **dargs)
File "/usr/code/autotest-devel/client/tests/virt/virt.py", line 133, in run_once
run_func(self, params, env)
File "/usr/code/autotest-devel/client/shared/error.py", line 138, in new_fn
return fn(*args, **kwargs)
File "/usr/code/autotest-devel/client/tests/virt/tests/unattended_install.py", line 1003, in run_unattended_install
dst, mount_point, image_name)
File "/usr/code/autotest-devel/client/tests/virt/virttest/funcatexit.py", line 50, in register
if func.func_name not in func.__globals__:
AttributeError: 'function' object has no attribute '__globals__'
In python 2.7:
>>> fuc.__globals__
{'__builtins__': <module '__builtin__' (built-in)>, '__name__': '__main__', 'fuc': <function fuc at 0x7f17b90778c0>, '__doc__': None, '__package__': None}
>>> fuc.func_name
'fuc'
>>> fuc.func_globals
{'__builtins__': <module '__builtin__' (built-in)>, '__name__': '__main__', 'fuc': <function fuc at 0x7f17b90778c0>, '__doc__': None, '__package__': None}
Signed-off-by: NFeng Yang <fyang@redhat.com>
Showing
想要评论请 注册 或 登录