blob: 33fa4b7f580e0d722eb3fa0c7ed2cf68bf0fdfa3 [file] [log] [blame]
# Copyright 2020 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
"""Full test of non-repo non-submodule functionality of checkout module."""
DEPS = [
'fuchsia/status_check',
'pigweed/checkout',
'recipe_engine/json',
'recipe_engine/properties',
'recipe_engine/step',
]
PYTHON_VERSION_COMPATIBILITY = "PY3"
def RunSteps(api): # pylint: disable=invalid-name
api.checkout()
def steplog(name, value): # pylint: disable=invalid-name
with api.step.nest(name) as pres:
pres.step_summary_text = repr(value)
# These lines are needed for coverage.
steplog('root', api.checkout.root)
steplog('revision', api.checkout.revision)
steplog('revision', api.checkout.revision) # Intentional repeat (caching).
steplog('remote', api.checkout.remote)
steplog('branch', api.checkout.branch)
steplog('manifest file', api.checkout.manifest_file)
steplog('manifest', api.checkout.manifest)
steplog('gerrit_host', api.checkout.gerrit_host())
steplog('gerrit_host_invalid', api.checkout.gerrit_host('bad'))
steplog('gerrit_project', api.checkout.gerrit_project())
steplog('gerrit_project_invalid', api.checkout.gerrit_project('bad'))
steplog('submodules', api.checkout.submodules())
def GenTests(api): # pylint: disable=invalid-name
def props(
host='https://pigweed.googlesource.com/pigweed/pigweed.git',
branch=None,
**kwargs
):
return api.properties(
**api.checkout.git_properties(remote=host, branch=branch, **kwargs)
)
yield (api.status_check.test('ci') + props() + api.checkout.ci_test_data())
yield (
api.status_check.test('try')
+ props(force_no_rebase=True)
+ api.checkout.try_test_data()
)
yield api.status_check.test('no_props') + api.checkout.try_test_data()
yield api.status_check.test('other') + props()
yield (
api.status_check.test('not_in_gerrit')
+ props()
+ api.step_data(
'checkout pigweed.change data.number', api.json.output({}),
)
)