diff options
| author | Carlos Fernandez <carlosfsanz@meta.com> | 2026-03-26 13:46:38 -0700 |
|---|---|---|
| committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2026-04-03 07:50:52 -0700 |
| commit | 573983948ae0550b0f655ea81431bb08ce0bd540 (patch) | |
| tree | 1065ee4ce7373f8bb164b5c66b824e141a74082c /tests/test_wrapper.py | |
| parent | 3f3c681a02ed27663e06c35328b494b9245881b5 (diff) | |
| download | git-repo-573983948ae0550b0f655ea81431bb08ce0bd540.tar.gz | |
Fix all flake8 warnings from newer flake8-bugbear and flake8-comprehensions
Address warnings introduced by flake8-bugbear 24.12.12 and
flake8-comprehensions 3.16.0:
- C408: Replace dict()/list() calls with literal {} and []
- C413: Remove unnecessary list() around sorted()
- C414: Remove unnecessary list() inside sorted()
- C419: Suppress intentional list comprehension in all() (noqa)
- B001: Replace bare except with except Exception
- B006: Replace mutable default arguments with None
- B010: Replace setattr() with direct attribute assignment
- B017: Use RuntimeError instead of Exception in tests
- B019: Suppress lru_cache on methods for long-lived objects (noqa)
- B033: Remove duplicate item in set literal
Change-Id: If4693d3e946200bbc22f689f7b94da604addcb80
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/566321
Tested-by: Carlos Fernandez <carlosfsanz@meta.com>
Commit-Queue: Carlos Fernandez <carlosfsanz@meta.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'tests/test_wrapper.py')
| -rw-r--r-- | tests/test_wrapper.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py index a38705675..36465e737 100644 --- a/tests/test_wrapper.py +++ b/tests/test_wrapper.py | |||
| @@ -385,11 +385,11 @@ class VerifyRev(RepoWrapperTestCase): | |||
| 385 | def test_verify_fails(self): | 385 | def test_verify_fails(self): |
| 386 | """Check we fall back to signed tag when we have an unsigned commit.""" | 386 | """Check we fall back to signed tag when we have an unsigned commit.""" |
| 387 | desc_result = subprocess.CompletedProcess([], 0, "v1.0-10-g1234\n", "") | 387 | desc_result = subprocess.CompletedProcess([], 0, "v1.0-10-g1234\n", "") |
| 388 | gpg_result = Exception | 388 | gpg_result = RuntimeError |
| 389 | with mock.patch.object( | 389 | with mock.patch.object( |
| 390 | self.wrapper, "run_git", side_effect=(desc_result, gpg_result) | 390 | self.wrapper, "run_git", side_effect=(desc_result, gpg_result) |
| 391 | ): | 391 | ): |
| 392 | with self.assertRaises(Exception): | 392 | with self.assertRaises(RuntimeError): |
| 393 | self.wrapper.verify_rev("/", "refs/heads/stable", "1234", True) | 393 | self.wrapper.verify_rev("/", "refs/heads/stable", "1234", True) |
| 394 | 394 | ||
| 395 | 395 | ||
| @@ -543,15 +543,15 @@ class CheckRepoRev(GitCheckoutTestCase): | |||
| 543 | self.wrapper, "check_repo_verify", return_value=True | 543 | self.wrapper, "check_repo_verify", return_value=True |
| 544 | ): | 544 | ): |
| 545 | with mock.patch.object( | 545 | with mock.patch.object( |
| 546 | self.wrapper, "verify_rev", side_effect=Exception | 546 | self.wrapper, "verify_rev", side_effect=RuntimeError |
| 547 | ): | 547 | ): |
| 548 | with self.assertRaises(Exception): | 548 | with self.assertRaises(RuntimeError): |
| 549 | self.wrapper.check_repo_rev(self.GIT_DIR, "stable") | 549 | self.wrapper.check_repo_rev(self.GIT_DIR, "stable") |
| 550 | 550 | ||
| 551 | def test_verify_ignore(self): | 551 | def test_verify_ignore(self): |
| 552 | """Should pass when verification is disabled.""" | 552 | """Should pass when verification is disabled.""" |
| 553 | with mock.patch.object( | 553 | with mock.patch.object( |
| 554 | self.wrapper, "verify_rev", side_effect=Exception | 554 | self.wrapper, "verify_rev", side_effect=RuntimeError |
| 555 | ): | 555 | ): |
| 556 | rrev, lrev = self.wrapper.check_repo_rev( | 556 | rrev, lrev = self.wrapper.check_repo_rev( |
| 557 | self.GIT_DIR, "stable", repo_verify=False | 557 | self.GIT_DIR, "stable", repo_verify=False |
