$ cat mytest.py
#!/usr/bin/python3
"""This demonstrates a bug in vmtest where subclasses would
unintentionally modify the super class 'extra_collect_scripts'.
We had this in:
TestLvmOverRaidAbs
TestLvmIscsiAbs
TestMdadmIscsiAbs
You can see the issue by running the script. You'll see that
MySuper.scripts actually gets 'fromMysub' in it."""
I've added another commit to the top to fix another issue i saw.
http:// paste.ubuntu. com/p/3bSnVyfrk W/
the paste above is more readable, but for inclusion i'll put here also.
$ python ./mytest.py ['FromSuper1' , 'FromSuper1', 'fromMysub'] ['FromSuper1' ]
super1=
super2=
sub=['FromSuper1', 'FromSuper1', 'fromMysub']
$ cat mytest.py collect_ scripts' .
#!/usr/bin/python3
"""This demonstrates a bug in vmtest where subclasses would
unintentionally modify the super class 'extra_
We had this in: idAbs
TestLvmOverRa
TestLvmIscsiAbs
TestMdadmIscsiAbs
You can see the issue by running the script. You'll see that
MySuper.scripts actually gets 'fromMysub' in it."""
class MySuper1(object):
scripts = ['FromSuper1']
class MySuper2(object):
scripts = ['FromSuper1']
class MySub(MySuper1, MySuper2):
scripts = MySuper1.scripts
scripts += MySuper2.scripts
scripts += ["fromMysub"]
print("super1=%s" % MySuper1.scripts)
print("super2=%s" % MySuper2.scripts)
print("sub=%s" % MySub.scripts)