new unit tests should use mock instead of mox  the above  mock ified  would look like this def test list instance ids empty self driver libvirt driver libvirtdriver fake fakevirtapi true with mock patch object driver get num instances return value as mocked self assertequal driver list instance ids 