Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1936)

Unified Diff: telemetry/telemetry/benchmark_unittest.py

Issue 2977283002: Ownership into GenericSets (Closed)
Patch Set: Fix tests after reabse Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « telemetry/telemetry/benchmark.py ('k') | telemetry/telemetry/internal/story_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/benchmark_unittest.py
diff --git a/telemetry/telemetry/benchmark_unittest.py b/telemetry/telemetry/benchmark_unittest.py
index cc04729f7c5f2a9fd1ebc7d6f760a96c95db7994..091b63ffb3663b6486a12c638b2f5169c7c84177 100644
--- a/telemetry/telemetry/benchmark_unittest.py
+++ b/telemetry/telemetry/benchmark_unittest.py
@@ -142,7 +142,41 @@ class BenchmarkTest(unittest.TestCase):
self.assertIsInstance(
b.GetExpectations(), story_module.expectations.StoryExpectations)
- def testBenchmarkOwnership(self):
+ def testGetOwners(self):
+ @benchmark.Owner(emails=['alice@chromium.org'])
+ class FooBenchmark(benchmark.Benchmark):
+ @classmethod
+ def Name(cls):
+ return "foo"
+
+ @benchmark.Owner(emails=['bob@chromium.org', 'ben@chromium.org'],
+ component='xyzzyx')
+ class BarBenchmark(benchmark.Benchmark):
+ @classmethod
+ def Name(cls):
+ return "bar"
+
+ @benchmark.Owner(component='xyzzyx')
+ class BazBenchmark(benchmark.Benchmark):
+ @classmethod
+ def Name(cls):
+ return "baz"
+
+ fooOwnersDiagnostic = FooBenchmark(None).GetOwners()
+ barOwnersDiagnostic = BarBenchmark(None).GetOwners()
+ bazOwnersDiagnostic = BazBenchmark(None).GetOwners()
+
+ self.assertIsInstance(fooOwnersDiagnostic, histogram.GenericSet)
+ self.assertIsInstance(barOwnersDiagnostic, histogram.GenericSet)
+ self.assertIsInstance(bazOwnersDiagnostic, histogram.GenericSet)
+
+ self.assertEqual(fooOwnersDiagnostic.AsDict()['values'],
+ ['alice@chromium.org'])
+ self.assertEqual(barOwnersDiagnostic.AsDict()['values'],
+ ['bob@chromium.org', 'ben@chromium.org'])
+ self.assertEqual(bazOwnersDiagnostic.AsDict()['values'], [])
+
+ def testGetBugComponents(self):
@benchmark.Owner(emails=['alice@chromium.org'])
class FooBenchmark(benchmark.Benchmark):
@classmethod
@@ -155,16 +189,14 @@ class BenchmarkTest(unittest.TestCase):
def Name(cls):
return "bar"
- fooOwnerDiangostic = FooBenchmark(None).GetOwnership()
- barOwnerDiangostic = BarBenchmark(None).GetOwnership()
+ fooBugComponentsDiagnostic = FooBenchmark(None).GetBugComponents()
+ barBugComponentsDiagnostic = BarBenchmark(None).GetBugComponents()
- self.assertIsInstance(fooOwnerDiangostic, histogram.Ownership)
- self.assertItemsEqual(fooOwnerDiangostic.emails, ['alice@chromium.org'])
- self.assertIsNone(fooOwnerDiangostic.component)
+ self.assertIsInstance(fooBugComponentsDiagnostic, histogram.GenericSet)
+ self.assertIsInstance(barBugComponentsDiagnostic, histogram.GenericSet)
- self.assertIsInstance(barOwnerDiangostic, histogram.Ownership)
- self.assertItemsEqual(barOwnerDiangostic.emails, ['bob@chromium.org'])
- self.assertEqual(barOwnerDiangostic.component, 'xyzzyx')
+ self.assertEqual(list(fooBugComponentsDiagnostic), [])
+ self.assertEqual(list(barBugComponentsDiagnostic), ['xyzzyx'])
def testGetTBMOptionsSupportsLegacyName(self):
class TbmBenchmark(benchmark.Benchmark):
@@ -257,4 +289,3 @@ class BenchmarkTest(unittest.TestCase):
self.assertEqual(
['string', 'foo', 'stuff', 'bar'],
tbm._tbm_options.config.atrace_config.categories)
-
« no previous file with comments | « telemetry/telemetry/benchmark.py ('k') | telemetry/telemetry/internal/story_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698