Ejemplo n.º 1
0
  def testInfoStringOnSubClass(self):

    @decorators.Info(emails=['*****@*****.**'], component='comp',
                     documentation_url='https://car.com')
    class Car(object):
      pass

    class Ford(Car):
      pass

    self.assertEquals(['*****@*****.**'], decorators.GetEmails(Car))
    self.assertEquals('comp', decorators.GetComponent(Car))
    self.assertEquals('https://car.com', decorators.GetDocumentationLink(Car))
    self.assertFalse(decorators.GetEmails(Ford))
    self.assertFalse(decorators.GetComponent(Ford))
    self.assertFalse(decorators.GetDocumentationLink(Ford))
Ejemplo n.º 2
0
  def GetDocumentationLink(self):
    """Returns a Generic Diagnostic containing the benchmark's documentation
       link in a string.

    Returns:
      Diagnostic with the link (string) to the benchmark documentation.
    """
    pair = ['Benchmark documentation link',
            decorators.GetDocumentationLink(self)]
    return generic_set.GenericSet([pair])
Ejemplo n.º 3
0
def get_all_benchmarks_metadata(metadata):
  benchmark_list = current_benchmarks()

  for benchmark in benchmark_list:
    emails = decorators.GetEmails(benchmark)
    if emails:
      emails = ', '.join(emails)
    metadata[benchmark.Name()] = BenchmarkMetadata(
        emails, decorators.GetComponent(benchmark),
        decorators.GetDocumentationLink(benchmark), False)
  return metadata
Ejemplo n.º 4
0
    def GetDocumentationLinks(self):
        """Return the benchmark's documentation links.

    Returns:
      A list of [title, url] pairs. This is the form that allows Dashboard
      to display links properly.
    """
        return [[
            'Benchmark documentation link',
            decorators.GetDocumentationLink(self)
        ]]
Ejemplo n.º 5
0
  def testInfoStringOnClass(self):

    @decorators.Info(emails=['*****@*****.**'],
                     documentation_url='http://foo.com')
    class Ford(object):
      pass

    self.assertEquals(['*****@*****.**'], decorators.GetEmails(Ford))

    @decorators.Info(emails=['*****@*****.**'])
    @decorators.Info(component='component',
                     documentation_url='http://bar.com')
    class Honda(object):
      pass

    self.assertEquals(['*****@*****.**'], decorators.GetEmails(Honda))
    self.assertEquals('http://bar.com', decorators.GetDocumentationLink(Honda))
    self.assertEquals('component', decorators.GetComponent(Honda))
    self.assertEquals(['*****@*****.**'], decorators.GetEmails(Ford))
    self.assertEquals('http://foo.com', decorators.GetDocumentationLink(Ford))
Ejemplo n.º 6
0
    def GetDocumentationLinks(self):
        """Return the benchmark's documentation links.

    Returns:
      A list of [title, url] pairs. This is the form that allows Dashboard
      to display links properly.
    """
        links = []
        url = decorators.GetDocumentationLink(self)
        if url is not None:
            links.append(['Benchmark documentation link', url])
        return links
Ejemplo n.º 7
0
def _get_telemetry_perf_benchmarks_metadata():
    metadata = {}
    benchmark_list = benchmark_finders.GetAllPerfBenchmarks()

    for benchmark in benchmark_list:
        emails = decorators.GetEmails(benchmark)
        if emails:
            emails = ', '.join(emails)
        tags_set = benchmark_utils.GetStoryTags(benchmark())
        metadata[benchmark.Name()] = BenchmarkMetadata(
            emails, decorators.GetComponent(benchmark),
            decorators.GetDocumentationLink(benchmark), ','.join(tags_set))
    return metadata
Ejemplo n.º 8
0
def _get_telemetry_perf_benchmarks_metadata():
    metadata = {}
    for benchmark in benchmark_finders.GetOfficialBenchmarks():
        benchmark_name = benchmark.Name()
        emails = decorators.GetEmails(benchmark)
        if emails:
            emails = ', '.join(emails)
        metadata[benchmark_name] = BenchmarkMetadata(
            emails=emails,
            component=decorators.GetComponent(benchmark),
            documentation_url=decorators.GetDocumentationLink(benchmark),
            stories=benchmark_utils.GetBenchmarkStoryInfo(benchmark()))
    return metadata