From 78d32ff67a3d5c9bb7940f11c74a9683024eea9b Mon Sep 17 00:00:00 2001 From: Allen Li Date: Fri, 9 Aug 2024 01:52:26 +0000 Subject: [PATCH] [scm_mock] Add global_state param to mock Change-Id: If0b35ead4804c17d8ec8acdf7bff96cfe73349b8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5773569 Reviewed-by: Josip Sokcevic Commit-Queue: Allen Li --- tests/scm_mock.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/scm_mock.py b/tests/scm_mock.py index 411db9116..36ec9dd61 100644 --- a/tests/scm_mock.py +++ b/tests/scm_mock.py @@ -7,6 +7,7 @@ from __future__ import annotations import os import sys import threading +from typing import Iterable from unittest import mock import unittest @@ -19,7 +20,7 @@ import scm def GIT(test: unittest.TestCase, *, - branchref: str | None = None): + branchref: str | None = None) -> Iterable[tuple[str, list[str]]]: """Installs fakes/mocks for scm.GIT so that: * GetBranch will just return a fake branchname starting with the value of @@ -54,3 +55,5 @@ def GIT(test: unittest.TestCase, test.addCleanup(p.stop) test.addCleanup(scm.GIT.drop_config_cache) + + return global_state.items()