Browse Source

[scm_mock] Fix types

Change-Id: I3d1dba2d8c3adc5ef4cf475514174b1d3f817010
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5773567
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
Allen Li 1 year ago
parent
commit
a1c9f5ecef
1 changed files with 5 additions and 4 deletions
  1. 5 4
      tests/scm_mock.py

+ 5 - 4
tests/scm_mock.py

@@ -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)),