<div dir="ltr">On 15 October 2013 03:13, Dylan Baker <span dir="ltr"><<a href="mailto:baker.dylan.c@gmail.com" target="_blank">baker.dylan.c@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This is the commonly excepted "right way" in python.<br>
<br>
Signed-off-by: Dylan Baker <<a href="mailto:baker.dylan.c@gmail.com">baker.dylan.c@gmail.com</a>><br></blockquote><div><br></div><div>Something in this series regressed the "changes", "problems", and "regressions" links in the piglit HTML output. As of commit aaae592 (summary.py: Fix regression in Summary class) those pages show up empty, even if there really are changes, problems, or regressions. In commit ad97d8b (summary.py: Replace ``import from'' syntax with import), the links work fine. I can't bisect further because of the regression fixed in commit aaae592.<br>
<br></div><div>I don't know whether the "skipped" and "fixes" links work properly or not.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
framework/summary.py | 77 ++++++++++++++++++++++++----------------------------<br>
1 file changed, 36 insertions(+), 41 deletions(-)<br>
<br>
diff --git a/framework/summary.py b/framework/summary.py<br>
index 3ab71f3..359d078 100644<br>
--- a/framework/summary.py<br>
+++ b/framework/summary.py<br>
@@ -428,13 +428,12 @@ class Summary:<br>
for each in self.results:<br>
os.mkdir(path.join(destination, <a href="http://each.name" target="_blank">each.name</a>))<br>
<br>
- file = open(path.join(destination, <a href="http://each.name" target="_blank">each.name</a>, "index.html"), 'w')<br>
- file.write(testindex.render(name=<a href="http://each.name" target="_blank">each.name</a>,<br>
- time=each.time_elapsed,<br>
- options=each.options,<br>
- glxinfo=each.glxinfo,<br>
- lspci=each.lspci))<br>
- file.close()<br>
+ with open(path.join(destination, <a href="http://each.name" target="_blank">each.name</a>, "index.html"), 'w') as out:<br>
+ out.write(testindex.render(name=<a href="http://each.name" target="_blank">each.name</a>,<br>
+ time=each.time_elapsed,<br>
+ options=each.options,<br>
+ glxinfo=each.glxinfo,<br>
+ lspci=each.lspci))<br>
<br>
# Then build the individual test results<br>
for key, value in each.tests.iteritems():<br>
@@ -447,21 +446,19 @@ class Summary:<br>
if not path.exists(temp_path):<br>
os.makedirs(temp_path)<br>
<br>
- file = open(path.join(destination,<br>
- <a href="http://each.name" target="_blank">each.name</a>,<br>
- key + ".html"), 'w')<br>
- file.write(testfile.render(<br>
- testname=key,<br>
- status=value.get('result', 'None'),<br>
- returncode=value.get('returncode', 'None'),<br>
- time=value.get('time', 'None'),<br>
- info=value.get('info', 'None'),<br>
- traceback=value.get('traceback', 'None'),<br>
- command=value.get('command', 'None'),<br>
- dmesg=value.get('dmesg', 'None'),<br>
- css=path.relpath(result_css, temp_path),<br>
- index=path.relpath(index, temp_path)))<br>
- file.close()<br>
+ with open(path.join(destination, <a href="http://each.name" target="_blank">each.name</a>, key + ".html"),<br>
+ 'w') as out:<br>
+ out.write(testfile.render(<br>
+ testname=key,<br>
+ status=value.get('result', 'None'),<br>
+ returncode=value.get('returncode', 'None'),<br>
+ time=value.get('time', 'None'),<br>
+ info=value.get('info', 'None'),<br>
+ traceback=value.get('traceback', 'None'),<br>
+ command=value.get('command', 'None'),<br>
+ dmesg=value.get('dmesg', 'None'),<br>
+ css=path.relpath(result_css, temp_path),<br>
+ index=path.relpath(index, temp_path)))<br>
<br>
# Finally build the root html files: index, regressions, etc<br>
index = Template(filename="templates/index.mako",<br>
@@ -477,30 +474,28 @@ class Summary:<br>
# Index.html is a bit of a special case since there is index, all, and<br>
# alltests, where the other pages all use the same name. ie,<br>
# changes.html, self.changes, and page=changes.<br>
- file = open(path.join(destination, "index.html"), 'w')<br>
- file.write(index.render(results=HTMLIndex(self, self.tests['all']),<br>
- page='all',<br>
- pages=pages,<br>
- colnum=len(self.results),<br>
- exclude=exclude))<br>
- file.close()<br>
+ with open(path.join(destination, "index.html"), 'w') as out:<br>
+ out.write(index.render(results=HTMLIndex(self, self.tests['all']),<br>
+ page='all',<br>
+ pages=pages,<br>
+ colnum=len(self.results),<br>
+ exclude=exclude))<br>
<br>
# Generate the rest of the pages<br>
for page in pages:<br>
- file = open(path.join(destination, page + '.html'), 'w')<br>
+ with open(path.join(destination, page + '.html'), 'w') as out:<br>
# If there is information to display display it<br>
- if self.tests[page]:<br>
- file.write(index.render(results=HTMLIndex(self,<br>
- self.tests[page]),<br>
- pages=pages,<br>
- page=page,<br>
- colnum=len(self.results),<br>
- exclude=exclude))<br>
- # otherwise provide an empty page<br>
- else:<br>
- file.write(empty_status.render(page=page, pages=pages))<br>
+ if self.tests[page]:<br>
+ out.write(index.render(results=HTMLIndex(self,<br>
+ self.tests[page]),<br>
+ pages=pages,<br>
+ page=page,<br>
+ colnum=len(self.results),<br>
+ exclude=exclude))<br>
+ # otherwise provide an empty page<br>
+ else:<br>
+ out.write(empty_status.render(page=page, pages=pages))<br>
<br>
- file.close()<br>
<br>
def generate_text(self, diff, summary):<br>
""" Write summary information to the console """<br>
<span class=""><font color="#888888">--<br>
1.8.1.5<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br></div></div>