[Piglit] [PATCH 05/18] program_tests.py: fix bug reseting PIGILT_CONFIG

Dylan Baker baker.dylan.c at gmail.com
Tue Aug 19 13:24:59 PDT 2014


Currently the function that is supposed to reset core.PIGLIT_CONFIG
doesn't actually reset it, it does a comparison, which is meaningless.
This patch fixes that, and shows that there are actually two failures.

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

diff --git a/framework/tests/programs_tests.py b/framework/tests/programs_tests.py
index cd706c7..1fe2227 100644
--- a/framework/tests/programs_tests.py
+++ b/framework/tests/programs_tests.py
@@ -40,10 +40,15 @@ dir = foo
 """
 
 
+def _reset_piglit_config():
+    """ Set core.PIGLIT_CONFIG back to pristine """
+    core.PIGLIT_CONFIG = ConfigParser.SafeConfigParser()
+
+
 class TestGetConfigEnv(utils.TestWithEnvClean):
     def test(self):
         """ get_config() finds $XDG_CONFIG_HOME/piglit.conf """
-        self.defer(lambda: core.PIGLIT_CONFIG == ConfigParser.SafeConfigParser)
+        self.defer(_reset_piglit_config)
         self.add_teardown('XDG_CONFIG_HOME')
         if os.path.exists('piglit.conf'):
             shutil.move('piglit.conf', 'piglit.conf.restore')
@@ -62,7 +67,8 @@ class TestGetConfigEnv(utils.TestWithEnvClean):
 class TestGetConfigHomeFallback(utils.TestWithEnvClean):
     def test(self):
         """ get_config() finds $HOME/.config/piglit.conf """
-        self.defer(lambda: core.PIGLIT_CONFIG == ConfigParser.SafeConfigParser)
+        self.defer(_reset_piglit_config)
+        self.add_teardown('XDG_CONFIG_HOME')
         self.add_teardown('HOME')
         self.add_teardown('XDG_CONFIG_HOME')
         if os.path.exists('piglit.conf'):
@@ -83,7 +89,7 @@ class TestGetConfigLocal(utils.TestWithEnvClean):
     # These need to be empty to force '.' to be used
     def test(self):
         """ get_config() finds ./piglit.conf """
-        self.defer(lambda: core.PIGLIT_CONFIG == ConfigParser.SafeConfigParser)
+        self.defer(_reset_piglit_config)
         self.add_teardown('HOME')
         self.add_teardown('XDG_CONFIG_HOME')
         if os.path.exists('piglit.conf'):
@@ -106,7 +112,7 @@ class TestGetConfigLocal(utils.TestWithEnvClean):
 class TestGetConfigRoot(utils.TestWithEnvClean):
     def test(self):
         """ get_config() finds "piglit root"/piglit.conf """
-        self.defer(lambda: core.PIGLIT_CONFIG == ConfigParser.SafeConfigParser)
+        self.defer(_reset_piglit_config)
         self.add_teardown('HOME')
         self.add_teardown('XDG_CONFIG_HOME')
 
-- 
2.0.4



More information about the Piglit mailing list