tw2-tests /

#!/usr/bin/env python

import mako.template
from datetime import datetime
from _repolist import repos

# API Design ANTI-PATTERN.  Don't look at this.  :)
from tw2.devtools.browser import WbPage as page
import tw2.core.core
from tw2.core import make_middleware

tmpl_str = """
<link rel='stylesheet' href='threebean.css' type='text/css'>
<script type="text/javascript" src=""></script>
<div class="wrapper">
<h2><code>tw2</code> tests</h2>
% for r in repos:
    <td><a href="${r.url}">[repo]</a></td>
    <td><a href="${}">[demo]</a></td>
    <td>${sparkwidget( |n}</td>
    <td><a href="htmlcov-${repr(r)}/index.html">${r.coverage}</a></td>
    <td><a href="results-${repr(r)}">${r.tests}</a></td>
% endfor
<div class="push"></div>
    <div class="footer">
    <p>This is a project of <a href="">[three]</a>.  Tests are
    run nightly.  Last generated at ${timestamp}.</p>
    If you'd like to see your widget library listed on this page or the
    <a href="">demo page</a>, please email the
    <a href="">toscawidgets-discuss</a> mailing list.</p>

if __name__ == '__main__':
    # Ridiculous hack :/
    rl = tw2.core.core.request_local()
    rl['middleware'] = make_middleware()
    page = page.req()

    for r in repos:
    template = mako.template.Template(tmpl_str)
    output = template.render(repos=repos, sparkwidget=page.commits,
                   '%F %T'))
    with open('htmlcov/index.html', 'w') as f: