virt-libvirt: unittest virsh isolation
Many unittests require testing codepaths containing
the virsh module and/or Virsh() class instances. However
it is necessary to isolate them from eachother AND provide
a check to make sure no "real" system-virsh calls are made.
To make this work easier for other unittests, added a
factory function that returns a mocked Virsh() class instance.
Every closed method on this instance will raise a
bogusVirshFailureException (subclass of
unittest.TestCase.failureException).
Now, unittest tests only need to call this function and
override the resulting instance's methods as needed for
testing. I also added a unittest to do a basic check of
this new unittest helper function.
Signed-off-by: NChris Evich <cevich@redhat.com>
Showing
想要评论请 注册 或 登录