[ovirt-devel] Mocks for oVirt Python SDK code

Barak Korren bkorren at redhat.com
Mon Aug 14 11:39:54 UTC 2017


On 14 August 2017 at 14:21, Yaniv Kaul <ykaul at redhat.com> wrote:
> I was wondering if there are any examples of mocks written for code written
> on top of the oVirt Python SDK.
> I would assume there will be a different a call mocking sdk.Connection()
> that would return a mock'ed object and from there continue?
>
> Context: I'm looking into writing an oVirt driver for some project. They
> (rightfully so) ask for unit tests, using mocks, fixtures, etc. I'm unsure
> this is really going to be easy or meaningful, but I thought I'd look into
> it...

A little aside, but I typically find that if you have to write any
mocks of your own rather then using the python-mock package
(unitest.mock in Python3), it means you're probably doing systems
tests instead of unit tests, or your code design is not very testable.

-- 
Barak Korren
RHV DevOps team , RHCE, RHCi
Red Hat EMEA
redhat.com | TRIED. TESTED. TRUSTED. | redhat.com/trusted


More information about the Devel mailing list