|
@@ -2,11 +2,12 @@
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
+from __future__ import annotations
|
|
|
|
+
|
|
import os
|
|
import os
|
|
import sys
|
|
import sys
|
|
import threading
|
|
import threading
|
|
|
|
|
|
-from typing import Dict, List, Optional
|
|
|
|
from unittest import mock
|
|
from unittest import mock
|
|
import unittest
|
|
import unittest
|
|
|
|
|
|
@@ -17,8 +18,8 @@ import scm
|
|
|
|
|
|
|
|
|
|
def GIT(test: unittest.TestCase,
|
|
def GIT(test: unittest.TestCase,
|
|
- config: Optional[Dict[str, List[str]]] = None,
|
|
|
|
- branchref: Optional[str] = None):
|
|
|
|
|
|
+ config: dict[str, list[str]] | None = None,
|
|
|
|
+ branchref: str | None = None):
|
|
"""Installs fakes/mocks for scm.GIT so that:
|
|
"""Installs fakes/mocks for scm.GIT so that:
|
|
|
|
|
|
* Initial git config (local scope) is set to `config`.
|
|
* Initial git config (local scope) is set to `config`.
|
|
@@ -43,7 +44,7 @@ def GIT(test: unittest.TestCase,
|
|
def _newBranch(branchref):
|
|
def _newBranch(branchref):
|
|
_branchref[0] = branchref
|
|
_branchref[0] = branchref
|
|
|
|
|
|
- patches: List[mock._patch] = [
|
|
|
|
|
|
+ patches: list[mock._patch] = [
|
|
mock.patch('scm.GIT._new_config_state',
|
|
mock.patch('scm.GIT._new_config_state',
|
|
side_effect=lambda _: scm.GitConfigStateTest(
|
|
side_effect=lambda _: scm.GitConfigStateTest(
|
|
global_lock, global_state, local_state=config)),
|
|
global_lock, global_state, local_state=config)),
|