Ala Hino has uploaded a new change for review.

Change subject: tests: Changed the unit test code to use permutation.
......................................................................

tests: Changed the unit test code to use permutation.

Change-Id: I7cacc89f9a8ddfef56b3c27234acb0a1cd1f60ed
Signed-off-by: Ala Hino <[email protected]>
---
M tests/miscTests.py
1 file changed, 9 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/38031/1

diff --git a/tests/miscTests.py b/tests/miscTests.py
index c52237b..d042d45 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -35,6 +35,7 @@
 from testlib import temporaryPath
 from testlib import namedTemporaryDir
 from testlib import TEMPDIR
+from testlib import permutations, expandPermutations
 import inspect
 from multiprocessing import Process
 from vdsm import utils
@@ -878,10 +879,9 @@
                           baseDir, False)
         self.assertTrue(os.path.lexists(baseDir))
 
-
+@expandPermutations
 class ReadSpeed(TestCaseBase):
-    STATS_TESTS = (
-        # output, bytes, seconds
+    @permutations([
         ("1 byte (1 B) copied, 1 s, 1 B/s", "1", "1"),
         ("1024 bytes (1 kB) copied, 1 s, 1 kB/s", "1024", "1"),
         ("1572864 bytes (1.5 MB) copied, 1.5 s, 1 MB/s", "1572864", "1.5"),
@@ -889,15 +889,13 @@
         ("479 bytes (479 B) copied, 5.6832e-05 s, 8.4 MB/s", "479", 
"5.6832e-05"),
         ("512 bytes (512e-3 MB) copied, 1 s, 512e-3 MB/s", "512", "1"),
         ("524288 bytes (512e3 B) copied, 1 s, 512e3 B/s", "524288", "1")
-    )
+    ])
+    def testReadSpeedRegExp(self, output, bytes, seconds):
+        m = misc._readspeed_regex.match(output)
+        self.assertNotEqual(m, None)
 
-    def testReadSpeedRegExp(self):
-        for output, bytes, seconds in self.STATS_TESTS:
-            m = misc._readspeed_regex.match(output)
-            self.assertNotEqual(m, None)
-
-            self.assertEqual(m.group("bytes"), bytes)
-            self.assertEqual(m.group("seconds"), seconds)
+        self.assertEqual(m.group("bytes"), bytes)
+        self.assertEqual(m.group("seconds"), seconds)
 
 class PidExists(TestCaseBase):
     def testPidExists(self):


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

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

Reply via email to