Antoni Segura Puimedon has uploaded a new change for review.

Change subject: Make netinfoTests follow closely python guidelines.
......................................................................

Make netinfoTests follow closely python guidelines.

Change 'file' by 'open' and use a with block not to wait for gc.
Prefer list comprehensions to map and filter.

Change-Id: Ie4774eb1c89914f2bb77db3cb25d8266fcf1f060
Signed-off-by: Antoni S. Puimedon <[email protected]>
---
M tests/netinfoTests.py
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/17/8717/1

diff --git a/tests/netinfoTests.py b/tests/netinfoTests.py
index 95570fa..5c028c6 100644
--- a/tests/netinfoTests.py
+++ b/tests/netinfoTests.py
@@ -33,11 +33,12 @@
 
     def testNetmaskConversions(self):
         path = os.path.join(os.path.dirname(__file__), "netmaskconversions")
-        for line in file(path):
-            if line.startswith('#'):
-                continue
-            bitmask, address = map(str.strip, line.split())
-            self.assertEqual(netinfo.bitmask_to_address(int(bitmask)), address)
+        with open(path) as netmaskFile:
+            for line in netmaskFile:
+                if line.startswith('#'):
+                    continue
+                bitmask, address = [value.strip() for value in line.split()]
+                self.assertEqual(netinfo.bitmask_to_address(int(bitmask)), 
address)
 
     def testSpeedInvalidNic(self):
         nicName = 'DUMMYNICDEVNAME'


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4774eb1c89914f2bb77db3cb25d8266fcf1f060
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to