[Piglit] [Patch v2 4/9] glsl_parser_test.py: Remove redundant StringIO creation

Dylan Baker baker.dylan.c at gmail.com
Fri Jul 11 08:14:17 PDT 2014


Previously the code read a StringIO, then immediately created a new one
to write the read text into. This is silly, by just setting the tell
back to position 0 the same effect can be had without the need to read
and write the contents.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/glsl_parser_test.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
index 21b3f83..e1b0a37 100644
--- a/framework/glsl_parser_test.py
+++ b/framework/glsl_parser_test.py
@@ -105,9 +105,8 @@ class GLSLParserTest(PiglitTest):
             defaults={'require_extensions': '', 'check_link': 'false'})
 
         # Verify that the config was valid
-        text = text_io.getvalue()
-        text_io.close()
-        config.readfp(StringIO(text))
+        text_io.seek(0)
+        config.readfp(text_io)
 
         for opt in ['expect_result', 'glsl_version']:
             if not config.has_option('config', opt):
-- 
2.0.0



More information about the Piglit mailing list