mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
[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>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user