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 <alonbl(a)redhat.com>
---
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 <alonbl(a)redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alonbl(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Eduardo <ewarszaw(a)redhat.com>
Gerrit-Reviewer: Gal Hammer <ghammer(a)redhat.com>
Gerrit-Reviewer: Igor Lvovsky <ilvovsky(a)redhat.com>
Gerrit-Reviewer: Livnat Peer <lpeer(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server