Skip to content

Commit

Permalink
git-pw: Enable test-state filter on list subcommand
Browse files Browse the repository at this point in the history
This new filter allows to filter lists by test states; some examples:

$ git pw list --test-state success

NOTES:
* The test state queried correspond to the last revision
* If there are many tests done against a particular series/revision (having
  different name each), the test state 'summary' would be the one having
  more priority, currently defined as 'pending', 'success', 'warning' and
  'failure', the former has the lowest priority and the latter the highest.

v2: A few minor tweaks (Damien)
    #154

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
  • Loading branch information
Leonardo Sandoval authored and Damien Lespiau committed Feb 18, 2016
1 parent 9073551 commit 42c681a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions git-pw/git-pw
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,23 @@ class User(object):
self.password = password


class TestState(object):
PENDING = 0
SUCCESS = 1
WARNING = 2
FAILURE = 3
CHOICES = (
(PENDING, 'pending'),
(SUCCESS, 'success'),
(WARNING, 'warning'),
(FAILURE, 'failure'),
)

@classmethod
def choices(cls):
return [s for _, s in cls.CHOICES]


class RestObject(object):

def __init__(self, patchwork):
Expand Down Expand Up @@ -635,6 +652,8 @@ class GitPatchwork(object):
elif self.cmd.updated_since:
params['ordering'] = 'last_updated'
params['updated_since'] = self.cmd.updated_since
elif self.cmd.test_state:
params['test_state'] = self.cmd.test_state

series_list = []
try:
Expand Down Expand Up @@ -913,6 +932,10 @@ if __name__ == '__main__':
type=str, choices=Series.FIELDS, default=default_series_fields,
help='list of fields to display')

list_parser.add_argument('--test-state', metavar='test_state',
type=str, choices=TestState.choices(),
help='retrieve series with a particular test state')

git_pw = GitPatchwork()
parser.parse_args(namespace=git_pw.cmd)

Expand Down

0 comments on commit 42c681a

Please sign in to comment.