Add a method to the git API for running git number.
Change-Id: Ieac13aac86df1c3e759f5aa66015ee6a3ac5c826 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3307495 Commit-Queue: Garrett Beaty <gbeaty@google.com> Auto-Submit: Garrett Beaty <gbeaty@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>changes/95/3307495/5
parent
804165b445
commit
320a1caf81
@ -0,0 +1,62 @@
|
||||
# Copyright 2013 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
from recipe_engine import post_process
|
||||
|
||||
PYTHON_VERSION_COMPATIBILITY = 'PY2+3'
|
||||
|
||||
DEPS = [
|
||||
'git',
|
||||
'recipe_engine/assertions',
|
||||
'recipe_engine/properties',
|
||||
]
|
||||
|
||||
|
||||
def RunSteps(api):
|
||||
numbers = api.git.number(
|
||||
commitrefs=api.properties.get('commitrefs'),
|
||||
test_values=api.properties.get('test_values'),
|
||||
)
|
||||
expected_numbers = api.properties['expected_numbers']
|
||||
api.assertions.assertSequenceEqual(numbers, expected_numbers)
|
||||
|
||||
|
||||
def GenTests(api):
|
||||
yield api.test(
|
||||
'basic',
|
||||
api.properties(expected_numbers=['3000']),
|
||||
api.post_check(post_process.StatusSuccess),
|
||||
api.post_process(post_process.DropExpectation),
|
||||
)
|
||||
|
||||
yield api.test(
|
||||
'commitrefs',
|
||||
api.properties(
|
||||
commitrefs=['rev-1', 'rev-2'],
|
||||
expected_numbers=['3000', '3001'],
|
||||
),
|
||||
api.post_check(post_process.StatusSuccess),
|
||||
api.post_process(post_process.DropExpectation),
|
||||
)
|
||||
|
||||
yield api.test(
|
||||
'basic-with-test-values',
|
||||
api.properties(
|
||||
test_values=[42],
|
||||
expected_numbers=['42'],
|
||||
),
|
||||
api.post_check(post_process.StatusSuccess),
|
||||
api.post_process(post_process.DropExpectation),
|
||||
)
|
||||
|
||||
yield api.test(
|
||||
'commitrefs-with-test-values',
|
||||
api.properties(
|
||||
test_values=[42, 13],
|
||||
commitrefs=['rev-1', 'rev-2'],
|
||||
expected_numbers=['42', '13'],
|
||||
),
|
||||
api.post_check(post_process.StatusSuccess),
|
||||
api.post_process(post_process.DropExpectation),
|
||||
)
|
Loading…
Reference in New Issue