Nir Soffer has posted comments on this change. Change subject: test: Use mock module for testing ......................................................................
Patch Set 1: (1 comment) https://gerrit.ovirt.org/#/c/55342/1/lib/vdsm/compat.py File lib/vdsm/compat.py: Line 50: from unittest import mock Line 51: mock Line 52: except ImportError: # py2 Line 53: import mock Line 54: mock > mock has been added to the standard library for a good reason, it is a comp When using py.test, there is not reason to use another solution for monkeypatching. Since we already have monkeypatching solution, and we want to move to py.test, I don't want to add code using a 3rd monkeypatching solution. The mock module is good only for simple cases when you do one call and want to mock the single return value. If you have a flow with several calls, and the return value may change based on the state of the fake object, you need to write fake objects. Check for example vmfakelib.Domain. You cannot do this with mock or it will require huge amount of code in your tests. -- To view, visit https://gerrit.ovirt.org/55342 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1c0af7baab7c35a2617bd60a62a0b1534e5f8894 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Edward Haas <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Edward Haas <[email protected]> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: Ondřej Svoboda <[email protected]> Gerrit-Reviewer: Petr Horáček <[email protected]> Gerrit-Reviewer: Yaniv Bronhaim <[email protected]> Gerrit-Reviewer: gerrit-hooks <[email protected]> Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
