There is a bug I meet but could not find the root cause(it should be a python bug), and I try to reproduce this bug without avocado but failed. So I mark it here.
I will provide a easy way to reproduce it with avocado.
Prepare a large python file like following(This file is simplified virttest/virsh.py):
class Testtest(object):
def __init__(self):
a = list(globals().items())
def run(test, params, env):
a = testtest.Testtest()
3. Run the case and the first time it maybe pass, but from the second time, it will report a RuntimeError:
Traceback (most recent call last):
File "/var/lib/libvirt_gating/code/avocado/avocado/core/test.py", line 938, in _run_avocado
raise test_exception
File "/var/lib/libvirt_gating/code/avocado/avocado/core/test.py", line 839, in _run_avocado
testMethod()
File "/var/lib/libvirt_gating/code/avocado-vt/avocado_vt/test.py", line 312, in runTest
raise self.__status # pylint: disable=E0702
File "/var/lib/libvirt_gating/code/avocado-vt/avocado_vt/test.py", line 263, in setUp
self._runTest()
File "/var/lib/libvirt_gating/code/avocado-vt/avocado_vt/test.py", line 438, in _runTest
run_func(self, params, env)
File "/var/lib/avocado/data/avocado-vt/test-providers.d/downloads/io-github-autotest-libvirt/libvirt/tests/src/test.py", line 85, in run
tttt = testttest.Testtest()
File "/var/lib/libvirt_gating/code/avocado-vt/virttest/testtest.py", line 16, in __init__
a = list(globals().items())
RuntimeError: dictionary changed size during iteration
Additional info:
1. In real test env, the Virsh class in virttest/virsh.py will use the globals().items(), so it will report the same error.
2. When I try to reduce the function + param counts in the large file, the case will be pass.
3. Only could reproduced in Python 3.7
Hi all,
There is a bug I meet but could not find the root cause(it should be a python bug), and I try to reproduce this bug without avocado but failed. So I mark it here.
I will provide a easy way to reproduce it with avocado.
def func0(test1=1, test2=1, test3=1, test4=1, test5=1, test6=1, test7=1, test8=1, test9=1, test10=1, **dargs): return 0
... Skipped the middle functions ...
def func999(test1=1, test2=1, test3=1, test4=1, test5=1, test6=1, test7=1, test8=1, test9=1, test10=1, **dargs): return 0
from virttest import testtest
def run(test, params, env): a = testtest.Testtest()