Ejemplo n.º 1
0
def _create_index(rst, type_name, start, delta):
    """ Creates index page string
    """
    logger.debug("Creating index %s, %s, %s", start, delta, delta_str(delta))
    index = ["Testrun: %s" % type_name]
    index += ["=" * len(index[0]), "", "**Summary:**", ""]
    index += ["* Number of tests: %s" % len(list(rst.keys()))]
    index += [
        "* Build time: %s" % "%s-%s-%s %s:%s:%s" %
        (start.year, start.month, start.day, start.hour, start.minute,
         start.second)
    ]
    index += ["* Build duration: %s" % delta_str(delta), ""]
    index += [".. toctree::", "    :maxdepth: 1", ""]
    index += ["    treeview", "    flatview", ""]
    return "\n".join(index)
Ejemplo n.º 2
0
    def test_delta_str_is_more_than_a_hour( self ):
        """
        Tests that the resulting string uses hours as unit
        """

        result = delta_str( datetime.timedelta( hours=1, seconds= 59 ) )
        self.assertEqual( "1:00:59 hours", result )
Ejemplo n.º 3
0
 def test_minutes_used_as_unit_if_delta_is_less_than_a_hour( self ):
     """
     Tests that the resulting string uses minutes as unit
     """
     start = datetime.datetime( 2010, 12, 24, 10, 10, 10 )
     end = datetime.datetime( 2010, 12, 24, 10, 11, 11 )
     result = delta_str( end - start )
     self.assertEqual( "1:01 minutes", result )
Ejemplo n.º 4
0
 def test_seconds_used_as_unit_if_delta_is_less_than_a_minute( self ):
     """
     Tests that the resulting string uses seconds as unit
     """
     start = datetime.datetime( 2010, 12, 24, 10, 10, 10 )
     end = datetime.datetime( 2010, 12, 24, 10, 11, 9 )
     result = delta_str( end - start )
     self.assertEqual( "59 seconds", result )
Ejemplo n.º 5
0
    def test_hours_used_as_unit_if_delta_is_more_than_a_hour( self ):
        """
        Tests that the resulting string uses hours as unit
        """

        start = datetime.datetime( 2010, 12, 24, 10, 10, 10 )
        end = datetime.datetime( 2010, 12, 24, 11, 11, 9 )
        result = delta_str( end - start )
        self.assertEqual( "1:00:59 hours", result )
Ejemplo n.º 6
0
 def test_delta_str_is_less_than_a_hour( self ):
     """
     Tests that the resulting string uses minutes as unit
     """
     result = delta_str( datetime.timedelta(seconds=61) )
     self.assertEqual( "1:01 minutes", result )
Ejemplo n.º 7
0
 def test_delta_str_is_less_than_a_minute( self ):
     """
     Tests that the resulting string uses seconds as unit
     """
     result = delta_str( datetime.timedelta(seconds=59) )
     self.assertEqual( "59 seconds", result )