[Piglit] [PATCH] bugzilla 71822: Fix regression introduced to piglit-run.py
Dylan Baker
baker.dylan.c at gmail.com
Wed Nov 20 16:10:09 PST 2013
The commit 0618aa38d4a8a7c82994fb28a41576da9a2cc414 introduces a
regression when using the -t/--include-filter or -x/--exclude-filter
options. This is caused by the __iter__ magic method in the
core.Environment class returning self.__dict__.iteritems(), which
returns compiled regex objects. This will cause the json encoder to
choke.
This patch corrects the __iter__ method in core.Environment to yield
regex items as regex.pattern, and attribute storing the original string
used to create the pattern.
cc: brianp at vmware.com
cc: vlee at freedesktop.org
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
framework/core.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/framework/core.py b/framework/core.py
index 91969dd..5a9e8b0 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -417,7 +417,14 @@ class Environment:
self.exclude_filter.append(re.compile(each))
def __iter__(self):
- return self.__dict__.iteritems()
+ for key, values in self.__dict__.iteritems():
+ # If the values are regex compiled then yield their pattern
+ # attribute, which is the original plaintext they were compiled
+ # from, otherwise yield them normally.
+ if key in ['filter', 'exclude_filter']:
+ yield (key, [x.pattern for x in values])
+ else:
+ yield (key, values)
def run(self, command):
try:
--
1.8.3.2
More information about the Piglit
mailing list