[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 <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
changes/69/5773569/6
Allen Li 12 months ago committed by LUCI CQ
parent f0f34c47f7
commit 78d32ff67a

@ -7,6 +7,7 @@ from __future__ import annotations
import os import os
import sys import sys
import threading import threading
from typing import Iterable
from unittest import mock from unittest import mock
import unittest import unittest
@ -19,7 +20,7 @@ import scm
def GIT(test: unittest.TestCase, 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: """Installs fakes/mocks for scm.GIT so that:
* GetBranch will just return a fake branchname starting with the value of * 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(p.stop)
test.addCleanup(scm.GIT.drop_config_cache) test.addCleanup(scm.GIT.drop_config_cache)
return global_state.items()

Loading…
Cancel
Save