lundi 25 juillet 2016

How to supply a mock class method for python unit test?

Let's say I have a class like this.

class SomeProductionProcess(CustomCachedSingleTon):

@def loaddata(): """ Uses an iterator over a large file in Production for the Data pipeline. """

Now at test time I want to change the logic inside the loaddata() method. It would be a simple custom logic that doesn't process large data.

How do we supply custom implementation of loaddata() at testtime using Python Mock UnitTest framework?

Aucun commentaire:

Enregistrer un commentaire