From a6413f5d88f12466b3daa833668d0f59fc65ece4 Mon Sep 17 00:00:00 2001 From: Jason Chang Date: Wed, 26 Jul 2023 13:23:40 -0700 Subject: 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 Reviewed-by: Aravind Vasudevan Tested-by: Jason Chang Reviewed-by: Joanna Wang --- tests/test_error.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'tests/test_error.py') 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 import unittest import error +import project +import git_command +from subcmds import all_modules + +imports = all_modules + [ + error, + project, + git_command, +] class PickleTests(unittest.TestCase): @@ -26,10 +35,11 @@ class PickleTests(unittest.TestCase): def getExceptions(self): """Return all our custom exceptions.""" - for name in dir(error): - cls = getattr(error, name) - if isinstance(cls, type) and issubclass(cls, Exception): - yield cls + for entry in imports: + for name in dir(entry): + cls = getattr(entry, name) + if isinstance(cls, type) and issubclass(cls, Exception): + yield cls def testExceptionLookup(self): """Make sure our introspection logic works.""" -- cgit v1.2.3-54-g00ecf