jeudi 22 janvier 2015

Nose - Is it possible to stub a class constant?

N00b at Nose framework here.


Looking at the docs for unittest.mock, I do not see an obvious way to stub a variable. I am testing a class with constants declared. One constant is a really large int and for testing purposes, I'd like to replace it with a much smaller int.


My understanding is that you can only mock (with the @patch decorator) a function, and not a variable.


Is this possible, and if so, how?


Aucun commentaire:

Enregistrer un commentaire