[autotest] Create generic bug filer function.
This makes it easier to file simple generic bugs. The user doesn't need to
create the Bug, create the Reporter and then call report().
BUG=None
TEST=Unittests. Manual test for passing_experimental.py.
Change-Id: I6d27cfa6a72b8dd4d22d8301b1c3105b90363a5a
Reviewed-on: https://chromium-review.googlesource.com/67009
Reviewed-by: Prashanth Balasubramanian <beeps@chromium.org>
Tested-by: Keyar Hood <keyar@chromium.org>
Commit-Queue: Prashanth Balasubramanian <beeps@chromium.org>
diff --git a/frontend/health/passing_experimental.py b/frontend/health/passing_experimental.py
index 3522310..2cca4d8 100755
--- a/frontend/health/passing_experimental.py
+++ b/frontend/health/passing_experimental.py
@@ -14,7 +14,7 @@
# Django and the models are only setup after
# the setup_django_readonly_environment module is imported.
from autotest_lib.frontend.afe import models as afe_models
-from autotest_lib.frontend.health import utils
+from autotest_lib.frontend.health import utils as test_health_utils
# Keep tests that have not failed for at least this many days.
@@ -78,7 +78,6 @@
@param tests: The tests that need to be marked as not experimental.
"""
- reporter = reporting.Reporter()
for test in tests:
title = '%s should be promoted to non-experimental.' % test
@@ -93,9 +92,8 @@
'autotest-best-practices#TOC-Control-files' %
(test, _MIN_DAYS_SINCE_FAILURE))
search_marker = 'PassingExperimental(%s)' % test
- bug = reporting.Bug(title=title, summary=summary,
- search_marker=search_marker)
- reporter.report(bug)
+ reporting.submit_generic_bug_report(title=title, summary=summary,
+ search_marker=search_marker)
def main(args=None):
@@ -112,8 +110,8 @@
parse_options(args)
experimental_tests = get_experimental_tests()
- pass_times = utils.get_last_pass_times()
- fail_times = utils.get_last_fail_times()
+ pass_times = test_health_utils.get_last_pass_times()
+ fail_times = test_health_utils.get_last_fail_times()
long_passers = find_long_passing_tests(pass_times, fail_times,
experimental_tests)
diff --git a/frontend/health/passing_experimental_functional_test.py b/frontend/health/passing_experimental_functional_test.py
index 9006044..1b2784f 100755
--- a/frontend/health/passing_experimental_functional_test.py
+++ b/frontend/health/passing_experimental_functional_test.py
@@ -103,17 +103,18 @@
MockDatetime.today().AndReturn(self.datetime(2012, 1, 21))
MockDatetime.today().AndReturn(self.datetime(2012, 1, 21))
- reporter = reporting.Reporter()
+ reporter1 = reporting.Reporter()
bug1 = reporting.Bug(
title=u'test1 should be promoted to non-experimental.',
summary=mox.IgnoreArg(),
search_marker=u'PassingExperimental(test1)')
- reporter.report(bug1)
+ reporter1.report(bug1).AndReturn((11, 1))
+ reporter2 = reporting.Reporter()
bug2 = reporting.Bug(
title=u'test2 should be promoted to non-experimental.',
summary=mox.IgnoreArg(),
search_marker=u'PassingExperimental(test2)')
- reporter.report(bug2)
+ reporter2.report(bug2).AndReturn((11, 1))
self.mox.ReplayAll()
passing_experimental.main()