提交 e8fb5588 编写于 作者: C Chris Evich

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>
上级 c09546e8
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册