blob: 8635818b4170f92c14ef0e746ce4b6c32c50fdcb [file] [log] [blame]
# Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
# for details. 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
from PB.recipe_modules.dart.build.build import Build
DEPS = [
'build',
'recipe_engine/file',
'recipe_engine/properties',
'recipe_engine/step',
]
def RunSteps(api):
api.step('python', [api.build.python])
api.build.python
def _check_python(api, python):
return api.post_process(post_process.StepCommandContains, 'python', [python])
def GenTests(api):
yield api.test(
'python',
_check_python(api, 'python'),
api.post_process(post_process.StatusSuccess),
)
yield api.test(
'detect-python3',
api.step_data(
'detect python version',
api.file.read_text(text_content='''#!/usr/bin/env python3
#
''')),
_check_python(api, 'python3'),
api.post_process(post_process.StatusSuccess),
)
yield api.test(
'force-python',
api.step_data(
'detect python version',
api.file.read_text(text_content='''#!/usr/bin/env python3
#
''')),
api.properties(python_version='python'),
_check_python(api, 'python'),
api.post_process(post_process.StatusSuccess),
)
yield api.test(
'force-python-wrong-python',
api.properties(python_version='python4'),
api.expect_exception('AssertionError'),
api.post_process(post_process.StatusException),
)