[Piglit] [PATCH 07/42] core_tests.py: Remove generator that creates a single test

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


Originally there were a lot of classes in core. Now there's only the
Options class, so all of this infrastructure serves no purpose. This
makes the actually functionality of the test obvious and much simpler.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/tests/core_tests.py | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/framework/tests/core_tests.py b/framework/tests/core_tests.py
index 4f6789d..e9a92fb 100644
--- a/framework/tests/core_tests.py
+++ b/framework/tests/core_tests.py
@@ -93,30 +93,10 @@ def _reset_piglit_config():
     core.PIGLIT_CONFIG = ConfigParser.SafeConfigParser()
 
 
-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)
-
-
- at utils.nose_generator
-def test_generate_initialize():
-    """ Generator that creates tests to initialize all of the classes in core
-
-    In a compiled language the compiler provides this kind of checking, but in
-    an interpreted language like python you don't have a compiler test. The
-    unit tests generated by this function serve as a similar test, does this
-    even work?
-
-    """
-    yieldable = check_initialize
-
-    for target in [core.Options]:
-        yieldable.description = "Test that {} initializes".format(
-            target.__name__)
-        yield yieldable, target
+ at utils.no_error
+def test_options_init():
+    """core.Options(): Class initializes"""
+    core.Options()
 
 
 def test_parse_listfile_return():
-- 
2.3.5



More information about the Piglit mailing list