Change in vdsm[master]: configNetworkTests: use context to manage monkey patches

danken at redhat.com danken at redhat.com
Mon Aug 6 14:54:38 UTC 2012


Dan Kenigsberg has posted comments on this change.

Change subject: configNetworkTests: use context to manage monkey patches
......................................................................


Patch Set 1: I would prefer that you didn't submit this

(3 inline comments)

Thanks for this important cleanup!

May I be rude to ask you to make it even cooler? It would be great to drop the repeated definition the context() function.

....................................................
File tests/configNetworkTests.py
Line 161:         def context():
eval() is generally evil, but I think it would be cool if we harness its dark powers for a more general solution - an context manager that receives a map like

 { 'os.path.exists': self._bondingOptExists}

perform the monkey-patching on __enter__, and clean them up on __exit__.

We could then use it as a decorator to the test function.

Line 169:         with context() as value:
do we need the "as value"?

Line 236:             self._addNetworkWithExc((netinfoIns, 'fakebrnet', vlan, bonding, nics,
these indentations would make pep8 and me cry.

--
To view, visit http://gerrit.ovirt.org/6939
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2ecb4589f2edbf605e62a8963889d314c2535537
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alonbl at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Igor Lvovsky <ilvovsky at redhat.com>
Gerrit-Reviewer: Livnat Peer <lpeer at redhat.com>


More information about the vdsm-patches mailing list