1*3c875a21SAndroid Build Coastguard Worker# 2*3c875a21SAndroid Build Coastguard Worker# Copyright (C) 2023 The Android Open Source Project 3*3c875a21SAndroid Build Coastguard Worker# 4*3c875a21SAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the 'License'); 5*3c875a21SAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 6*3c875a21SAndroid Build Coastguard Worker# You may obtain a copy of the License at 7*3c875a21SAndroid Build Coastguard Worker# 8*3c875a21SAndroid Build Coastguard Worker# http://www.apache.org/licenses/LICENSE-2.0 9*3c875a21SAndroid Build Coastguard Worker# 10*3c875a21SAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 11*3c875a21SAndroid Build Coastguard Worker# distributed under the License is distributed on an 'AS IS' BASIS, 12*3c875a21SAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*3c875a21SAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 14*3c875a21SAndroid Build Coastguard Worker# limitations under the License. 15*3c875a21SAndroid Build Coastguard Worker# 16*3c875a21SAndroid Build Coastguard Worker"""Pytest fixtures common across multiple test modules.""" 17*3c875a21SAndroid Build Coastguard Workerfrom pathlib import Path 18*3c875a21SAndroid Build Coastguard Worker 19*3c875a21SAndroid Build Coastguard Workerimport pytest 20*3c875a21SAndroid Build Coastguard Worker 21*3c875a21SAndroid Build Coastguard Worker 22*3c875a21SAndroid Build Coastguard Workerdef make_repo_tree(root: Path) -> Path: 23*3c875a21SAndroid Build Coastguard Worker """Creates a fake repo tree in the given root.""" 24*3c875a21SAndroid Build Coastguard Worker (root / ".repo").mkdir(parents=True) 25*3c875a21SAndroid Build Coastguard Worker (root / "external/foobar").mkdir(parents=True) 26*3c875a21SAndroid Build Coastguard Worker return root 27*3c875a21SAndroid Build Coastguard Worker 28*3c875a21SAndroid Build Coastguard Worker 29*3c875a21SAndroid Build Coastguard Worker@pytest.fixture(name="repo_tree") 30*3c875a21SAndroid Build Coastguard Workerdef fixture_repo_tree(tmp_path: Path) -> Path: 31*3c875a21SAndroid Build Coastguard Worker """Fixture for a repo tree.""" 32*3c875a21SAndroid Build Coastguard Worker return make_repo_tree(tmp_path) 33