Dan Kenigsberg has posted comments on this change. Change subject: Manage test dummies at the module level ......................................................................
Patch Set 3: Code-Review-1 (3 comments) Thanks for this patch. .................................................... File tests/functional/networkTests.py Line 46: # Current implementation converts ip to its 32 bit int representation Line 47: IP_TABLE = '4026531841' Line 48: dummyPool = [] Line 49: Line 50: since order does not matter, I think that a set() fits better here. Line 51: def setupModule(): Line 52: """Persists network configuration.""" Line 53: vdsm = VdsProxy() Line 54: vdsm.save_config() Line 67: def dummyIf(num): Line 68: """Manages a list of num dummy interfaces. Assumes root privileges.""" Line 69: dummies = [] Line 70: try: Line 71: dummies = [dummyPool.pop() for _ in range(num)] it would be cleaner to place this out of the try block. Even if the pool is exhausted (or any other exception), the "finally" clause would free nothing as dummies stays []. Line 72: yield dummies Line 73: except Exception: Line 74: raise Line 75: finally: Line 69: dummies = [] Line 70: try: Line 71: dummies = [dummyPool.pop() for _ in range(num)] Line 72: yield dummies Line 73: except Exception: what is the "except" clause good for? Line 74: raise Line 75: finally: Line 76: for nic in dummies: Line 77: dummyPool.append(nic) -- To view, visit http://gerrit.ovirt.org/19650 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5c040fc3175b5760728d749578728be60c75cb9b Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon <[email protected]> Gerrit-Reviewer: Assaf Muller <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Mark Wu <[email protected]> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
