コード例 #1
0
 def test_line_separator(self):
     output = StringIO()
     writer = HtmlWriter(output)
     writer.start('b')
     writer.end('b')
     writer.element('i')
     assert_equal(output.getvalue(), '<b>\n</b>\n<i></i>\n')
コード例 #2
0
def _download_and_format_issues():
    try:
        from robot.utils import HtmlWriter, html_format
    except ImportError:
        sys.exit('creating release requires Robot Framework to be installed.')
    URL = Template('http://code.google.com/p/robotframework-ride/issues/csv?'
                   'sort=priority+type&colspec=ID%20Type%20Priority%20Summary'
                   '&q=target%3A${version}&can=1')
    reader = csv.reader(urlopen(URL.substitute({'version': VERSION})))
    total_issues = 0
    writer = HtmlWriter(StringIO())
    writer.element('h2', 'Release notes for %s' % VERSION)
    writer.start('table', attrs={'border': '1'})
    for row in reader:
        if not row or row[1] == 'Task':
            continue
        row = row[:4]
        writer.start('tr')
        if reader.line_num == 1:
            row = ['*%s*' % cell for cell in row]
        else:
            row[0] = '<a href="http://code.google.com/p/robotframework-ride/'\
                     'issues/detail?id=%s">Issue %s</a>' % (row[0], row[0])
            total_issues += 1
        for cell in row:
            if reader.line_num == 1:
                cell = html_format(cell)
            writer.element('td', cell, escape=False)
        writer.end('tr')
    writer.end('table')
    writer.element('p', 'Altogether %d issues.' % total_issues)
    return writer.output.getvalue()
コード例 #3
0
def _download_and_format_issues():
    try:
        from robot.utils import HtmlWriter, html_format
    except ImportError:
        sys.exit('creating release requires Robot Framework to be installed.')
    writer = HtmlWriter(StringIO())
    writer.element('h2', 'Release notes for %s' % VERSION)
    writer.start('table', attrs={'border': '1'})
    writer.start('tr')
    for header in ['ID', 'Type', 'Priority', 'Summary']:
        writer.element('td', html_format('*{}*'.format(header)), escape=False)
    writer.end('tr')
    issues = list(_get_issues())
    for issue in issues:
        writer.start('tr')
        link_tmpl = '<a href="http://github.com/robotframework/RIDE/issues/{0}">Issue {0}</a>'
        row = [
            link_tmpl.format(issue.number),
            find_type(issue),
            find_priority(issue), issue.title
        ]
        for cell in row:
            writer.element('td', cell, escape=False)
        writer.end('tr')
    writer.end('table')
    writer.element('p', 'Altogether %d issues.' % len(issues))
    return writer.output.getvalue()
コード例 #4
0
 def _get_writers(self, base_dir):
     html_writer = HtmlWriter(self._output)
     return (self._model_writer,
             JsFileWriter(html_writer, base_dir),
             CssFileWriter(html_writer, base_dir),
             GeneratorWriter(html_writer),
             LineWriter(self._output))
コード例 #5
0
 def test_non_ascii(self):
     self.output = StringIO()
     writer = HtmlWriter(self.output)
     writer.start(u'p', attrs={'name': u'hyv\xe4\xe4'}, newline=False)
     writer.content(u'y\xf6')
     writer.element('i', u't\xe4', newline=False)
     writer.end('p', newline=False)
     self._verify(u'<p name="hyv\xe4\xe4">y\xf6<i>t\xe4</i></p>')
コード例 #6
0
 def _test_line_separator(self, linesep):
     output = StringIO()
     writer = HtmlWriter(output, line_separator=linesep)
     writer.start('b')
     writer.end('b')
     writer.element('i')
     expected = '<b>%(LS)s</b>%(LS)s<i></i>%(LS)s' % {'LS': linesep}
     assert_equals(repr(output.getvalue()), repr(expected))
コード例 #7
0
 def _test_encoding(self, encoding):
     self.output = StringIO()
     writer = HtmlWriter(self.output, encoding=encoding)
     writer.start(u'p', attrs={'name': u'hyv\xe4\xe4'}, newline=False)
     writer.content(u'y\xf6')
     writer.element('i', u't\xe4', newline=False)
     writer.end('p', newline=False)
     self._verify(
         u'<p name="hyv\xe4\xe4">y\xf6<i>t\xe4</i></p>'.encode(encoding))
コード例 #8
0
 def __init__(self,
              outpath=None,
              title=None,
              showDiffs=True,
              excludeMatch=False):
     self.outpath = os.path.abspath(outpath or 'robotdiff.html')
     self._title = title or 'Test Run Diff Report'
     self._writer = HtmlWriter(self.outpath)
     self._showDiffs = showDiffs
     self._excludeMatch = excludeMatch
コード例 #9
0
 def __init__(self, configuration):
     formatter = HtmlFormatter(configuration.html_column_count)
     _DataFileWriter.__init__(self, formatter, configuration)
     self._name = configuration.datafile.name
     self._writer = HtmlWriter(configuration.output)
コード例 #10
0
 def setUp(self):
     self.output = StringIO()
     self.writer = HtmlWriter(self.output)
コード例 #11
0
ファイル: robotdiff.py プロジェクト: laxmanCT/robotframework
 def __init__(self, outpath=None, title=None):
     self.outpath = os.path.abspath(outpath or 'robotdiff.html')
     self._title = title or 'Test Run Diff Report'
     self._writer = HtmlWriter(open(self.outpath, 'w'))
コード例 #12
0
 def setUp(self):
     self.out = IOMock()
     self.writer = HtmlWriter(self.out)
コード例 #13
0
 def setUp(self):
     self.output = StringIO()
     self.writer = HtmlWriter(self.output, encoding=None)