From e914ec293a414dc6cf092c1323c1c059943e706f Mon Sep 17 00:00:00 2001 From: Aravind Vasudevan Date: Thu, 31 Aug 2023 20:57:31 +0000 Subject: sync: Use repo logger within sync Bug: b/292704435 Change-Id: Iceb3ad5111e656a1ff9730ae5deb032a9b43b4a5 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383454 Commit-Queue: Aravind Vasudevan Tested-by: Aravind Vasudevan Reviewed-by: Mike Frysinger --- tests/test_repo_logging.py | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'tests') diff --git a/tests/test_repo_logging.py b/tests/test_repo_logging.py index 5402a90b..b51e6270 100644 --- a/tests/test_repo_logging.py +++ b/tests/test_repo_logging.py @@ -23,7 +23,6 @@ class TestRepoLogger(unittest.TestCase): def test_error_logs_error(self): """Test if error fn outputs logs.""" logger = RepoLogger(__name__) - RepoLogger.errors[:] = [] result = None def mock_handler(log): @@ -42,7 +41,6 @@ class TestRepoLogger(unittest.TestCase): def test_warning_logs_error(self): """Test if warning fn outputs logs.""" logger = RepoLogger(__name__) - RepoLogger.errors[:] = [] result = None def mock_handler(log): @@ -58,30 +56,9 @@ class TestRepoLogger(unittest.TestCase): self.assertEqual(result, "You know the rules and so do I (do I)") - def test_error_aggregates_error_msg(self): - """Test if error fn aggregates error logs.""" - logger = RepoLogger(__name__) - RepoLogger.errors[:] = [] - - logger.error("A full commitment's what I'm thinking of") - logger.error("You wouldn't get this from any other guy") - logger.error("I just wanna tell you how I'm feeling") - logger.error("Gotta make you understand") - - self.assertEqual( - RepoLogger.errors[:], - [ - "A full commitment's what I'm thinking of", - "You wouldn't get this from any other guy", - "I just wanna tell you how I'm feeling", - "Gotta make you understand", - ], - ) - def test_log_aggregated_errors_logs_aggregated_errors(self): """Test if log_aggregated_errors outputs aggregated errors.""" logger = RepoLogger(__name__) - RepoLogger.errors[:] = [] result = [] def mock_handler(log): @@ -96,7 +73,13 @@ class TestRepoLogger(unittest.TestCase): logger.error("Never gonna give you up") logger.error("Never gonna let you down") logger.error("Never gonna run around and desert you") - logger.log_aggregated_errors() + logger.log_aggregated_errors( + [ + "Never gonna give you up", + "Never gonna let you down", + "Never gonna run around and desert you", + ] + ) self.assertEqual( result, -- cgit v1.2.3-54-g00ecf