Dan Kenigsberg has submitted this change and it was merged.

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


configNetworkTests: use context to manage monkey patches

Easier to manage setup and cleanup at on place, then
trying to cleanup after a block of code, and catching
all exceptions.

Example of use:
 ---
from monkeypatch import MonkeyPatch

@MonkeyPatch(subprocess, 'Popen', lambda x: None)
@MonkeyPatch(os, 'chown', lambda *x: 0)
def test():
    logic

def test():
    with MonkeyPatchScope([
        (subprocess, 'Popen', lambda x: None),
        (os, 'chown', lambda *x: 0)
    ]):
        logic
 ---

Change-Id: I2ecb4589f2edbf605e62a8963889d314c2535537
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M tests/Makefile.am
M tests/configNetworkTests.py
A tests/monkeypatch.py
3 files changed, 111 insertions(+), 49 deletions(-)

Approvals:
  Alon Bar-Lev: Verified
  Gal Hammer: Looks good to me, but someone else must approve
  Dan Kenigsberg: Looks good to me, approved


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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2ecb4589f2edbf605e62a8963889d314c2535537
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Eduardo <[email protected]>
Gerrit-Reviewer: Gal Hammer <[email protected]>
Gerrit-Reviewer: Igor Lvovsky <[email protected]>
Gerrit-Reviewer: Livnat Peer <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to