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))
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))
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 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 GetBugComponents(self): """Returns a GenericSet Diagnostic containing the benchmark's Monorail component. Returns: GenericSet Diagnostic with the benchmark's bug component name """ benchmark_component = decorators.GetComponent(self) component_diagnostic_value = ([benchmark_component] if benchmark_component else []) return histogram.GenericSet(component_diagnostic_value)
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
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
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 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 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
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))
def GetBugComponents(self): """Return the benchmark's Monorail component as a string.""" return decorators.GetComponent(self)