Beispiel #1
0
    def testOwnerStringOnSubClass(self):
        @decorators.Owner(emails=['*****@*****.**'], component='comp')
        class Car(object):
            pass

        class Ford(Car):
            pass

        self.assertEquals(['*****@*****.**'], decorators.GetEmails(Car))
        self.assertEquals('comp', decorators.GetComponent(Car))
        self.assertFalse(decorators.GetEmails(Ford))
        self.assertFalse(decorators.GetComponent(Ford))
Beispiel #2
0
    def testOwnerStringOnClass(self):
        @decorators.Owner(emails=['*****@*****.**'])
        class Ford(object):
            pass

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

        @decorators.Owner(emails=['*****@*****.**'])
        @decorators.Owner(component='component')
        class Honda(object):
            pass

        self.assertEquals(['*****@*****.**'], decorators.GetEmails(Honda))
        self.assertEquals('component', decorators.GetComponent(Honda))
        self.assertEquals(['*****@*****.**'], decorators.GetEmails(Ford))
  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))
Beispiel #4
0
    def GetOwners(self):
        """Returns a Generic Diagnostic containing the benchmark's owners' emails
       in a list.

    Returns:
      Diagnostic with a list of the benchmark's owners' emails
    """
        return histogram.GenericSet(decorators.GetEmails(self) or [])
Beispiel #5
0
    def GetOwnership(self):
        """Returns an Ownership Diagnostic containing the benchmark's information.

    Returns:
      Diagnostic with the benchmark's owners' e-mails and component name
    """
        return histogram.Ownership(decorators.GetEmails(self),
                                   decorators.GetComponent(self))
  def testInfoWithDuplicateAttributeSetting(self):

    with self.assertRaises(AssertionError):
      @decorators.Info(emails=['*****@*****.**'])
      @decorators.Info(emails=['*****@*****.**'], component='comp')
      class Car(object):
        pass

      self.assertEquals(['*****@*****.**'], decorators.GetEmails(Car))
Beispiel #7
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), False)
  return metadata
  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))
Beispiel #9
0
def get_all_benchmarks_metadata(metadata):
    benchmark_list = current_benchmarks()

    for benchmark in benchmark_list:
        disabled = 'all' in decorators.GetDisabledAttributes(benchmark)

        emails = decorators.GetEmails(benchmark)
        if emails:
            emails = ', '.join(emails)
        metadata[benchmark.Name()] = BenchmarkMetadata(
            emails, decorators.GetComponent(benchmark), disabled)
    return metadata
Beispiel #10
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
Beispiel #11
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
def get_all_benchmarks_metadata(metadata):
    benchmark_list = current_benchmarks()

    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),
            False)
    return metadata
def get_all_benchmarks_metadata(metadata):
  benchmark_list = current_benchmarks()

  for benchmark in benchmark_list:
    exp = benchmark().GetExpectations()
    disabled = 'all' in decorators.GetDisabledAttributes(benchmark) or any(
        any(isinstance(condition, expectations.ALL.__class__)
            for condition in conditions)
        for (conditions, _) in exp.disabled_platforms)

    emails = decorators.GetEmails(benchmark)
    if emails:
      emails = ', '.join(emails)
    metadata[benchmark.Name()] = BenchmarkMetadata(
        emails, decorators.GetComponent(benchmark), disabled)
  return metadata
Beispiel #14
0
 def GetOwners(self):
     """Return the benchmark's owners' emails in a list."""
     return decorators.GetEmails(self)