summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@google.com>2023-09-29 11:04:49 -0400
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-10-31 16:03:54 +0000
commitb32ccbb66bb16965ecb8b4e266c4e45186636c1b (patch)
tree1c1eda32af709f0cbf822de56f696ccd531ce6de /tests
parentb99272c601bc5f466c3cfc782bb852c2c967ad27 (diff)
downloadgit-repo-b32ccbb66bb16965ecb8b4e266c4e45186636c1b.tar.gz
cleanup: Update codebase to expect Python 3.6
- Bump minimum version to Python 3.6. - Use f-strings in a lot of places. Change-Id: I2aa70197230fcec2eff8e7c8eb754f20c08075bb Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/389034 Tested-by: Jason R. Coombs <jaraco@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Jason R. Coombs <jaraco@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_git_command.py7
-rw-r--r--tests/test_git_config.py2
-rw-r--r--tests/test_git_superproject.py2
-rw-r--r--tests/test_git_trace2_event_log.py2
-rw-r--r--tests/test_manifest_xml.py6
-rw-r--r--tests/test_project.py2
6 files changed, 8 insertions, 13 deletions
diff --git a/tests/test_git_command.py b/tests/test_git_command.py
index 7c108ccd..ffee023b 100644
--- a/tests/test_git_command.py
+++ b/tests/test_git_command.py
@@ -19,12 +19,7 @@ import os
19import re 19import re
20import subprocess 20import subprocess
21import unittest 21import unittest
22 22from unittest import mock
23
24try:
25 from unittest import mock
26except ImportError:
27 import mock
28 23
29import git_command 24import git_command
30import wrapper 25import wrapper
diff --git a/tests/test_git_config.py b/tests/test_git_config.py
index a44dca0f..cf6e7793 100644
--- a/tests/test_git_config.py
+++ b/tests/test_git_config.py
@@ -100,7 +100,7 @@ class GitConfigReadOnlyTests(unittest.TestCase):
100 ("intg", 10737418240), 100 ("intg", 10737418240),
101 ) 101 )
102 for key, value in TESTS: 102 for key, value in TESTS:
103 self.assertEqual(value, self.config.GetInt("section.%s" % (key,))) 103 self.assertEqual(value, self.config.GetInt(f"section.{key}"))
104 104
105 105
106class GitConfigReadWriteTests(unittest.TestCase): 106class GitConfigReadWriteTests(unittest.TestCase):
diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py
index 478ebca7..4e66521b 100644
--- a/tests/test_git_superproject.py
+++ b/tests/test_git_superproject.py
@@ -34,7 +34,7 @@ class SuperprojectTestCase(unittest.TestCase):
34 PARENT_SID_KEY = "GIT_TRACE2_PARENT_SID" 34 PARENT_SID_KEY = "GIT_TRACE2_PARENT_SID"
35 PARENT_SID_VALUE = "parent_sid" 35 PARENT_SID_VALUE = "parent_sid"
36 SELF_SID_REGEX = r"repo-\d+T\d+Z-.*" 36 SELF_SID_REGEX = r"repo-\d+T\d+Z-.*"
37 FULL_SID_REGEX = r"^%s/%s" % (PARENT_SID_VALUE, SELF_SID_REGEX) 37 FULL_SID_REGEX = rf"^{PARENT_SID_VALUE}/{SELF_SID_REGEX}"
38 38
39 def setUp(self): 39 def setUp(self):
40 """Set up superproject every time.""" 40 """Set up superproject every time."""
diff --git a/tests/test_git_trace2_event_log.py b/tests/test_git_trace2_event_log.py
index d8e963dd..4658a793 100644
--- a/tests/test_git_trace2_event_log.py
+++ b/tests/test_git_trace2_event_log.py
@@ -61,7 +61,7 @@ class EventLogTestCase(unittest.TestCase):
61 PARENT_SID_KEY = "GIT_TRACE2_PARENT_SID" 61 PARENT_SID_KEY = "GIT_TRACE2_PARENT_SID"
62 PARENT_SID_VALUE = "parent_sid" 62 PARENT_SID_VALUE = "parent_sid"
63 SELF_SID_REGEX = r"repo-\d+T\d+Z-.*" 63 SELF_SID_REGEX = r"repo-\d+T\d+Z-.*"
64 FULL_SID_REGEX = r"^%s/%s" % (PARENT_SID_VALUE, SELF_SID_REGEX) 64 FULL_SID_REGEX = rf"^{PARENT_SID_VALUE}/{SELF_SID_REGEX}"
65 65
66 def setUp(self): 66 def setUp(self):
67 """Load the event_log module every time.""" 67 """Load the event_log module every time."""
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py
index bd255dcc..3fcf09fa 100644
--- a/tests/test_manifest_xml.py
+++ b/tests/test_manifest_xml.py
@@ -198,13 +198,13 @@ class ValueTests(unittest.TestCase):
198 def test_bool_true(self): 198 def test_bool_true(self):
199 """Check XmlBool true values.""" 199 """Check XmlBool true values."""
200 for value in ("yes", "true", "1"): 200 for value in ("yes", "true", "1"):
201 node = self._get_node('<node a="%s"/>' % (value,)) 201 node = self._get_node(f'<node a="{value}"/>')
202 self.assertTrue(manifest_xml.XmlBool(node, "a")) 202 self.assertTrue(manifest_xml.XmlBool(node, "a"))
203 203
204 def test_bool_false(self): 204 def test_bool_false(self):
205 """Check XmlBool false values.""" 205 """Check XmlBool false values."""
206 for value in ("no", "false", "0"): 206 for value in ("no", "false", "0"):
207 node = self._get_node('<node a="%s"/>' % (value,)) 207 node = self._get_node(f'<node a="{value}"/>')
208 self.assertFalse(manifest_xml.XmlBool(node, "a")) 208 self.assertFalse(manifest_xml.XmlBool(node, "a"))
209 209
210 def test_int_default(self): 210 def test_int_default(self):
@@ -220,7 +220,7 @@ class ValueTests(unittest.TestCase):
220 def test_int_good(self): 220 def test_int_good(self):
221 """Check XmlInt numeric handling.""" 221 """Check XmlInt numeric handling."""
222 for value in (-1, 0, 1, 50000): 222 for value in (-1, 0, 1, 50000):
223 node = self._get_node('<node a="%s"/>' % (value,)) 223 node = self._get_node(f'<node a="{value}"/>')
224 self.assertEqual(value, manifest_xml.XmlInt(node, "a")) 224 self.assertEqual(value, manifest_xml.XmlInt(node, "a"))
225 225
226 def test_int_invalid(self): 226 def test_int_invalid(self):
diff --git a/tests/test_project.py b/tests/test_project.py
index 83cfe0a4..6dc071bd 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -151,7 +151,7 @@ class CopyLinkTestCase(unittest.TestCase):
151 # "". 151 # "".
152 break 152 break
153 result = os.path.exists(path) 153 result = os.path.exists(path)
154 msg.append("\tos.path.exists(%s): %s" % (path, result)) 154 msg.append(f"\tos.path.exists({path}): {result}")
155 if result: 155 if result:
156 msg.append("\tcontents: %r" % os.listdir(path)) 156 msg.append("\tcontents: %r" % os.listdir(path))
157 break 157 break