summaryrefslogtreecommitdiffstats
path: root/tests/test_error.py
diff options
context:
space:
mode:
authorJason Chang <jasonnc@google.com>2023-07-26 13:23:40 -0700
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-07-31 21:31:36 +0000
commita6413f5d88f12466b3daa833668d0f59fc65ece4 (patch)
tree25410555a8941c500fbd55a974476ace04198dca /tests/test_error.py
parent8c35d948cfa76ec685ad36fb1cb3a0fcc749f428 (diff)
downloadgit-repo-a6413f5d88f12466b3daa833668d0f59fc65ece4.tar.gz
Update errors to extend BaseRepoError
In order to better analyze and track repo errors, repo command failures need to be tied to specific errors in repo source code. Additionally a new GitCommandError was added to differentiate between general git related errors to failed git commands. Git commands that opt into verification will raise a GitCommandError if the command failed. The first step in this process is a general error refactoring Bug: b/293344017 Change-Id: I46944b1825ce892757c8dd3f7e2fab7e460760c0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/380994 Commit-Queue: Jason Chang <jasonnc@google.com> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com> Tested-by: Jason Chang <jasonnc@google.com> Reviewed-by: Joanna Wang <jojwang@google.com>
Diffstat (limited to 'tests/test_error.py')
-rw-r--r--tests/test_error.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/test_error.py b/tests/test_error.py
index 784e2d57..2733ab8c 100644
--- a/tests/test_error.py
+++ b/tests/test_error.py
@@ -19,6 +19,15 @@ import pickle
19import unittest 19import unittest
20 20
21import error 21import error
22import project
23import git_command
24from subcmds import all_modules
25
26imports = all_modules + [
27 error,
28 project,
29 git_command,
30]
22 31
23 32
24class PickleTests(unittest.TestCase): 33class PickleTests(unittest.TestCase):
@@ -26,10 +35,11 @@ class PickleTests(unittest.TestCase):
26 35
27 def getExceptions(self): 36 def getExceptions(self):
28 """Return all our custom exceptions.""" 37 """Return all our custom exceptions."""
29 for name in dir(error): 38 for entry in imports:
30 cls = getattr(error, name) 39 for name in dir(entry):
31 if isinstance(cls, type) and issubclass(cls, Exception): 40 cls = getattr(entry, name)
32 yield cls 41 if isinstance(cls, type) and issubclass(cls, Exception):
42 yield cls
33 43
34 def testExceptionLookup(self): 44 def testExceptionLookup(self):
35 """Make sure our introspection logic works.""" 45 """Make sure our introspection logic works."""