public inbox for bunsen@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix Bunsen.testrun(commit_id)
@ 2021-07-30 19:22 Keith Seitz
  0 siblings, 0 replies; only message in thread
From: Keith Seitz @ 2021-07-30 19:22 UTC (permalink / raw)
  To: bunsen

The recent refactor commit a69fcff1 broke clients calling Bunsen.testrun
with a commit ID:

$ ./bunsen.py +summarize 60231993624ee6fa5ced3c8f4ae13bdeda3a94cf
Using branch index, checkout name wd-summarize
Running summarize at .../bunsen/.bunsen/wd-summarize from .../bunsen/scripts-main/summarize.py with ['60231993624ee6fa5ced3c8f4ae13bdeda3a94cf']
===
Traceback (most recent call last):
  File ".../bunsen/scripts-main/summarize.py", line 40, in <module>
    testrun = b.testrun(opts.commit)
  File ".../bunsen/bunsen/repo.py", line 906, in testrun
    candidate_branches.append(testrun_summary.bunsen_testruns_branch)
AttributeError: 'NoneType' object has no attribute 'bunsen_testruns_branch'

This is occurring because the code attempts to use `testrun_summary' in
a place where it is undefined:

        if project is None and extra_info is not None \
            and 'bunsen_testruns_branch' in extra_info:
            testrun_project, testrun_year_month, testrun_extra_label = \
                extra_info.commit_tag()
            project = testrun_project
            candidate_branches.append(testrun_summary.bunsen_testruns_branch)

`testrun_summary' is only defined when `testrun_or_commit_id' is an
instance of Testrun. In this case, we have a string representing the
commit ID.

Since `project' is None just before this block, `extra_info' is initialized
to a Testrun object. It is this object, therefore, in which we should
look for `bunsen_testruns_branch'.

This fixes scripts-master/summarize.py.
---
 bunsen/repo.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bunsen/repo.py b/bunsen/repo.py
index bc0b982..4d11a87 100644
--- a/bunsen/repo.py
+++ b/bunsen/repo.py
@@ -903,7 +903,7 @@ class Bunsen:
             testrun_project, testrun_year_month, testrun_extra_label = \
                 extra_info.commit_tag()
             project = testrun_project
-            candidate_branches.append(testrun_summary.bunsen_testruns_branch)
+            candidate_branches.append(extra_info.bunsen_testruns_branch)
 
         # Option 3: get project,year_month from commit message header.
         if project is None:
-- 
2.31.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-30 19:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 19:22 [PATCH] Fix Bunsen.testrun(commit_id) Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).