[Piglit] [PATCH 09/20] status_tests.py: Convert large test case into generator

Dylan Baker baker.dylan.c at gmail.com
Sat Jun 14 08:05:18 PDT 2014


This gives more fine-grained results
---
 framework/tests/status_tests.py | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/framework/tests/status_tests.py b/framework/tests/status_tests.py
index f4ae74a..a053de5 100644
--- a/framework/tests/status_tests.py
+++ b/framework/tests/status_tests.py
@@ -156,14 +156,30 @@ def test_not_change():
                status.status_lookup(stat))
 
 
+ at utils.nose_generator
 def test_max_statuses():
     """ Verify that max() works between skip and non-skip statuses """
     for nochange, stat in itertools.product(NO_OPS, STATUSES):
         nochange = status.status_lookup(nochange)
         stat = status.status_lookup(stat)
-        nt.assert_equal(
-            stat, max(nochange, stat),
-            msg="max({nochange}, {stat}) = {stat}".format(**locals()))
-        nt.assert_equal(
-            stat, max(stat, nochange),
-            msg="max({stat}, {nochange}) = {stat}".format(**locals()))
+        _max_nochange_stat.description = \
+            "max({nochange}, {stat}) = {stat}".format(**locals())
+        yield _max_nochange_stat, nochange, stat
+
+        _max_stat_nochange.description = \
+            "max({stat}, {nochange}) = {stat}".format(**locals())
+        yield _max_stat_nochange, nochange, stat
+
+
+def _max_nochange_stat(nochange, stat):
+    """ max(nochange, stat) should = stat """
+    nt.assert_equal(
+        stat, max(nochange, stat),
+        msg="max({nochange}, {stat}) = {stat}".format(**locals()))
+
+
+def _max_stat_nochange(nochange, stat):
+    """ max(stat, nochange) should = stat """
+    nt.assert_equal(
+        stat, max(stat, nochange),
+        msg="max({stat}, {nochange}) = {stat}".format(**locals()))
-- 
2.0.0



More information about the Piglit mailing list