def _verify_message(self, splitter, msg="X", level="INFO", html=False, timestamp=None, index=0):
     message = list(splitter)[index]
     assert_equal(message.message, msg)
     assert_equal(message.level, level)
     assert_equal(message.html, html)
     if timestamp:
         assert_equal(message.timestamp, format_time(timestamp, millissep="."))
 def _get_data(self, statistics, errors, basemillis):
     gentime = time.localtime()
     return OrderedDict([('stats', statistics), ('errors', errors),
                         ('baseMillis', basemillis),
                         ('generatedMillis',
                          long(time.mktime(gentime) * 1000) - basemillis),
                         ('generatedTimestamp',
                          format_time(gentime, gmtsep=' '))])
Ejemplo n.º 3
0
 def _get_data(self, statistics, errors, basemillis):
     gentime = time.localtime()
     return {
         "stats": statistics,
         "errors": errors,
         "baseMillis": basemillis,
         "generatedMillis": long(time.mktime(gentime) * 1000) - basemillis,
         "generatedTimestamp": utils.format_time(gentime, gmtsep=" "),
     }
 def _get_data(self, statistics, errors, basemillis):
     gentime = time.localtime()
     return {
         'stats': statistics,
         'errors': errors,
         'baseMillis': basemillis,
         'generatedMillis': int(time.mktime(gentime) * 1000) - basemillis,
         'generatedTimestamp': utils.format_time(gentime, gmtsep=' ')
     }
Ejemplo n.º 5
0
 def _get_data(self, statistics, errors, basemillis):
     gentime = time.localtime()
     return OrderedDict([
         ('stats', statistics),
         ('errors', errors),
         ('baseMillis', basemillis),
         ('generatedMillis', int(time.mktime(gentime) * 1000 - basemillis)),
         ('generatedTimestamp', format_time(gentime, gmtsep=' '))
         ])
Ejemplo n.º 6
0
 def _get_data(self, statistics, errors, basemillis):
     gentime = time.localtime()
     return {
         'stats': statistics,
         'errors': errors,
         'baseMillis': basemillis,
         'generatedMillis': long(time.mktime(gentime) * 1000) - basemillis,
         'generatedTimestamp': utils.format_time(gentime, gmtsep=' ')
     }
Ejemplo n.º 7
0
 def _verify_message(self, splitter, msg='X', level='INFO', html=False,
                     timestamp=None, index=0):
     message = list(splitter)[index]
     assert_equals(message.message, msg)
     assert_equals(message.level, level)
     assert_equals(message.html, html)
     if timestamp:
         assert_equals(message.timestamp,
                       format_time(timestamp, millissep='.'))
Ejemplo n.º 8
0
 def write_data(self):
     generated_time = time.localtime()
     model = {
         'suite': JsonConverter(self._output_path).convert(self._suite),
         'title': self._title,
         'generated': format_time(generated_time, gmtsep=' '),
         'generatedMillis': int(time.mktime(generated_time) * 1000)
     }
     JsonWriter(self._output).write_json('testdoc = ', model)
Ejemplo n.º 9
0
 def write_data(self):
     generated_time = time.localtime()
     model = {
         'suite': JsonConverter(self._output_path).convert(self._suite),
         'title': self._title,
         'generated': utils.format_time(generated_time, gmtsep=' '),
         'generatedMillis': long(time.mktime(generated_time) * 1000)
     }
     JsonWriter(self._output).write_json('testdoc = ', model)
Ejemplo n.º 10
0
 def _get_data(self, statistics, errors, basemillis):
     gentime = time.localtime()
     return OrderedDict(
         [
             ("stats", statistics),
             ("errors", errors),
             ("baseMillis", basemillis),
             ("generatedMillis", long(time.mktime(gentime) * 1000) - basemillis),
             ("generatedTimestamp", format_time(gentime, gmtsep=" ")),
         ]
     )
Ejemplo n.º 11
0
 def _use_template(self, outfile, template, title, background=None):
     ttuple = time.localtime()
     str_time = utils.format_time(ttuple, daytimesep=' ', gmtsep=' ')
     int_time = long(time.mktime(ttuple))
     elapsed_time = utils.elapsed_time_to_string(self.suite.elapsedtime)
     namespace = Namespace(gentime_str=str_time,
                           gentime_int=int_time,
                           elapsed_time=elapsed_time,
                           version=get_full_version(self._generator),
                           suite=self.suite,
                           title=title,
                           background=background)
     Template(template=template).generate(namespace, outfile)
Ejemplo n.º 12
0
 def _use_template(self, outfile, template, title, background=None):
     ttuple = time.localtime()
     str_time = utils.format_time(ttuple,
                                  daytimesep=' ',
                                  gmtsep=' ')
     int_time = long(time.mktime(ttuple))
     elapsed_time = utils.elapsed_time_to_string(self.suite.elapsedtime)
     namespace = Namespace(gentime_str=str_time,
                           gentime_int=int_time,
                           elapsed_time=elapsed_time,
                           version=get_full_version(self._generator),
                           suite=self.suite,
                           title=title,
                           background=background)
     Template(template=template).generate(namespace, outfile)
Ejemplo n.º 13
0
def serialize_test_doc(suite, outpath, title):
    outfile = open(outpath, 'w')
    serializer = TestdocSerializer(outfile, suite)
    ttuple = time.localtime()
    str_time = utils.format_time(ttuple, daytimesep=' ', gmtsep=' ')
    int_time = long(time.mktime(ttuple))
    if title:
        title = title.replace('_', ' ')
    else:
        title = 'Documentation for %s' % suite.name
    namespace = Namespace(gentime_str=str_time,
                          gentime_int=int_time,
                          version=version.get_full_version('testdoc.py'),
                          suite=suite,
                          title=title)
    Template(template=templates.LOG).generate(namespace, outfile)
    suite.serialize(serializer)
    outfile.write('</body>\n</html>\n')
    outfile.close()
 def _format_timestamp(self, millis):
     return utils.format_time(float(millis) / 1000, millissep='.')
Ejemplo n.º 15
0
 def __init__(self, options=None, **extra_options):
     self.start_timestamp = format_time(time.time(), '', '-', '')
     self._opts = {}
     self._cli_opts = self._cli_opts.copy()
     self._cli_opts.update(self._extra_cli_opts)
     self._process_cli_opts(dict(options or {}, **extra_options))
 def _set_generated(self, timetuple):
     genMillis = long(time.mktime(timetuple) * 1000) -\
                     self._robot_data['baseMillis']
     self._set_attr('generatedMillis', genMillis)
     self._set_attr('generatedTimestamp',
                    utils.format_time(timetuple, gmtsep=' '))
Ejemplo n.º 17
0
 def _format_timestamp(self, millis):
     return format_time(float(millis)/1000, millissep='.')
Ejemplo n.º 18
0
 def __init__(self, options=None, **extra_options):
     self.start_timestamp = format_time(time.time(), '', '-', '')
     self._opts = {}
     self._cli_opts = self._cli_opts.copy()
     self._cli_opts.update(self._extra_cli_opts)
     self._process_cli_opts(dict(options or {}, **extra_options))