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

Unified Diff: tools/perf/benchmarks/benchmark_smoke_unittest.py

Issue 687893002: Propagate decorators properly in telemetry_perf_unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@switch_tel_over
Patch Set: add a TODO to discover all tests Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/benchmarks/benchmark_smoke_unittest.py
diff --git a/tools/perf/benchmarks/benchmark_smoke_unittest.py b/tools/perf/benchmarks/benchmark_smoke_unittest.py
index 2239a38023594b15fb6af903f6d3b8699422b07a..d8f757dc84249d9c4f1ca434d04fc9cf98d4693e 100644
--- a/tools/perf/benchmarks/benchmark_smoke_unittest.py
+++ b/tools/perf/benchmarks/benchmark_smoke_unittest.py
@@ -94,7 +94,21 @@ def load_tests(_, _2, _3):
class BenchmarkSmokeTest(unittest.TestCase):
pass
- setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark))
+
+ method = SmokeTestGenerator(benchmark)
+
+ # Make sure any decorators are propagated from the original declaration.
+ # (access to protected members) pylint: disable=W0212
+ # TODO(dpranke): Since we only pick the first test from every class
+ # (above), if that test is disabled, we'll end up not running *any*
+ # test from the class. We should probably discover all of the tests
+ # in a class, and then throw the ones we don't need away instead.
+ if hasattr(benchmark, '_enabled_strings'):
+ method._enabled_strings = benchmark._enabled_strings
+ if hasattr(benchmark, '_disabled_strings'):
+ method._disabled_strings = benchmark._disabled_strings
+ setattr(BenchmarkSmokeTest, benchmark.Name(), method)
+
suite.addTest(BenchmarkSmokeTest(benchmark.Name()))
return suite
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698