blob: 65105cfa56e18acb347098a5c3e1e7cb71306426 [file] [log] [blame]
# Copyright 2024 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.
"""Recipe that reliably produces strings of failures and passes.
This recipe only exists to test features implemented for b/377570481.
TODO: b/377570481 - Delete this recipe.
"""
from __future__ import annotations
from typing import Generator
from recipe_engine import post_process, recipe_api, recipe_test_api
DEPS = [
'recipe_engine/step',
'recipe_engine/time',
]
def RunSteps(api: recipe_api.RecipeScriptApi) -> result.RawResult | None:
"""Run Pigweed presubmit checks."""
now = api.time.utcnow()
api.step.empty('now').presentation.step_summary_text = repr(now)
if now.hour < 12:
api.step.empty('pass') # pragma: no cover
else:
api.step.empty('fail', status='FAILURE')
def GenTests(api) -> Generator[recipe_test_api.TestData, None, None]:
"""Create tests."""
yield api.test(
'basic',
api.post_process(post_process.DropExpectation),
status='FAILURE',
)