[test] Replace remaining generative tests by subtests
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 03 Mar 2016 10:25:32 +0100
changeset 11180 c2a8317d4eec
parent 11179 104d41c99180
child 11181 2a7fb3422ae1
[test] Replace remaining generative tests by subtests
cubicweb/test/unittest_predicates.py
cubicweb/web/test/unittest_application.py
--- a/cubicweb/test/unittest_predicates.py	Mon Mar 14 18:15:09 2016 +0100
+++ b/cubicweb/test/unittest_predicates.py	Thu Mar 03 10:25:32 2016 +0100
@@ -327,7 +327,8 @@
 
             for (expected, operator, assertion) in testdata:
                 selector = multi_lines_rset(expected, operator)
-                yield self.assertEqual, selector(None, req, rset=rset), assertion
+                with self.subTest(expected=expected, operator=operator):
+                    self.assertEqual(selector(None, req, rset=rset), assertion)
 
 
 class MatchKwargsTC(TestCase):
--- a/cubicweb/web/test/unittest_application.py	Mon Mar 14 18:15:09 2016 +0100
+++ b/cubicweb/web/test/unittest_application.py	Thu Mar 03 10:25:32 2016 +0100
@@ -527,10 +527,9 @@
         """test against current script injection"""
         injected = '<i>toto</i>'
         cleaned = 'toto'
-        for kwargs in ({'vid': injected},
-                       {'vtitle': injected},
-                       ):
-            yield self._test_cleaned, kwargs, injected, cleaned
+        for kwargs in ({'vid': injected}, {'vtitle': injected}):
+            with self.subTest(**kwargs):
+                self._test_cleaned(kwargs, injected, cleaned)
 
     def test_site_wide_eproperties_sync(self):
         # XXX work in all-in-one configuration but not in twisted for instance