| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2d7f861 commit e0e5918
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -575,11 +575,14 @@ def _iter_from_process_or_stream(cls, repo: "Repo", proc_or_stream: Union[Popen, | |||
| 575 | 575 | ||
| 576 | 576 | if hasattr(proc_or_stream, "wait"): | |
| 577 | 577 | proc_or_stream = cast(Popen, proc_or_stream) | |
| 578 | - if proc_or_stream.stdout is not None: | ||
| 579 | - stream = proc_or_stream.stdout | ||
| 578 | + stream = proc_or_stream.stdout | ||
| 579 | + if stream is None: | ||
| 580 | + raise ValueError("Process has no stdout stream") | ||
| 580 | 581 | elif hasattr(proc_or_stream, "readline"): | |
| 581 | 582 | proc_or_stream = cast(IO, proc_or_stream) # type: ignore[redundant-cast] | |
| 582 | 583 | stream = proc_or_stream | |
| 584 | + else: | ||
| 585 | + raise TypeError("Expected a process or stream") | ||
| 583 | 586 | ||
| 584 | 587 | readline = stream.readline | |
| 585 | 588 | while True: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | 8 | import git | |
| 9 | 9 | from git.exc import InvalidGitRepositoryError | |
| 10 | + from git.util import IterableList | ||
| 10 | 11 | ||
| 11 | 12 | from .base import Submodule, UpdateProgress | |
| 12 | 13 | from .util import find_first_remote_branch | |
@@ -19,7 +20,6 @@ | |||
| 19 | 20 | ||
| 20 | 21 | if TYPE_CHECKING: | |
| 21 | 22 | from git.repo import Repo | |
| 22 | - from git.util import IterableList | ||
| 23 | 23 | ||
| 24 | 24 | # ---------------------------------------------------------------------------- | |
| 25 | 25 | ||
@@ -162,6 +162,7 @@ def update( # type: ignore[override] | |||
| 162 | 162 | prefix = "DRY-RUN: " | |
| 163 | 163 | ||
| 164 | 164 | repo = self.repo | |
| 165 | + sms: "IterableList[Submodule]" = IterableList("name") | ||
| 165 | 166 | ||
| 166 | 167 | try: | |
| 167 | 168 | # SETUP BASE COMMIT | |
@@ -182,7 +183,7 @@ def update( # type: ignore[override] | |||
| 182 | 183 | # END handle previous commit | |
| 183 | 184 | ||
| 184 | 185 | psms: "IterableList[Submodule]" = self.list_items(repo, parent_commit=previous_commit) | |
| 185 | - sms: "IterableList[Submodule]" = self.list_items(repo) | ||
| 186 | + sms = self.list_items(repo) | ||
| 186 | 187 | spsms = set(psms) | |
| 187 | 188 | ssms = set(sms) | |
| 188 | 189 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -327,6 +327,11 @@ def test_rev_list_bisect_all(self): | |||
| 327 | 327 | for sha1, commit in zip(expected_ids, commits): | |
| 328 | 328 | self.assertEqual(sha1, commit.hexsha) | |
| 329 | 329 | ||
| 330 | + def test_iter_from_invalid_process_or_stream(self): | ||
| 331 | + for source, error in ((Mock(wait=Mock(), stdout=None), ValueError), (object(), TypeError)): | ||
| 332 | + with self.assertRaises(error): | ||
| 333 | + list(Commit._iter_from_process_or_stream(self.rorepo, source)) | ||
| 334 | + | ||
| 330 | 335 | @with_rw_directory | |
| 331 | 336 | def test_ambiguous_arg_iteration(self, rw_dir): | |
| 332 | 337 | rw_repo = Repo.init(osp.join(rw_dir, "test_ambiguous_arg")) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -511,6 +511,9 @@ def test_root_module(self, rwrepo): | |||
| 511 | 511 | # Cannot set the parent commit as root module's path didn't exist. | |
| 512 | 512 | self.assertRaises(ValueError, rm.set_parent_commit, "HEAD") | |
| 513 | 513 | ||
| 514 | + with mock.patch.object(RootModule, "list_items", side_effect=ValueError("boom")): | ||
| 515 | + rm.update(keep_going=True) | ||
| 516 | + | ||
| 514 | 517 | # TEST UPDATE | |
| 515 | 518 | ############# | |
| 516 | 519 | # Set up a commit that removes existing, adds new and modifies existing | |
| Back | FazBrowse Home | New Git URL |
0 commit comments