[Piglit] [PATCH 20/42] results_tests.py: simplify initializer tests

Dylan Baker baker.dylan.c at gmail.com
Wed Apr 22 15:10:09 PDT 2015


Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/tests/results_tests.py | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/framework/tests/results_tests.py b/framework/tests/results_tests.py
index 4fc49c5..e7bc74b 100644
--- a/framework/tests/results_tests.py
+++ b/framework/tests/results_tests.py
@@ -27,15 +27,6 @@ from framework import results, status
 import framework.tests.utils as utils
 
 
- at utils.no_error
-def check_initialize(target):
-    """ Check that a class initializes without error """
-    func = target()
-    # Asserting that func exists will fail for Group and TestrunResult which
-    # are dict subclasses
-    assert isinstance(func, target)
-
-
 @utils.nose_generator
 def test_generate_initialize():
     """ Generator that creates tests to initialize all of the classes in core
@@ -46,12 +37,14 @@ def test_generate_initialize():
     even work?
 
     """
-    yieldable = check_initialize
+    @utils.no_error
+    def check(target):
+        target()
 
     for target in [results.TestrunResult, results.TestResult]:
-        yieldable.description = "Test that {} initializes".format(
+        check.description = "Test that {} initializes".format(
             target.__name__)
-        yield yieldable, target
+        yield check, target
 
 
 def test_testresult_load_to_status():
-- 
2.3.5



More information about the Piglit mailing list