Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a58afe

Browse files
sroetByron
authored andcommitted
update tests and add a comment about different behaviour of 'push' vs 'fetch'
1 parentef0ca65 commit0a58afe

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

‎git/remote.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,8 @@ def stdout_handler(line: str) -> None:
795795
try:
796796
proc.wait(stderr=stderr_text)
797797
exceptException:
798+
# This is different than fetch (which fails if there is any std_err
799+
# even if there is an output)
798800
ifnotoutput:
799801
raise
800802
elifstderr_text:

‎test/test_remote.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
importrandom
88
importtempfile
9+
importpytest
910
fromunittestimportskipIf
1011

1112
fromgitimport (
@@ -401,12 +402,12 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo):
401402
res=remote.push(all=True)
402403
self._do_test_push_result(res,remote)
403404

404-
remote.pull('master',timeout=10.0)
405+
remote.pull('master',kill_after_timeout=10.0)
405406

406407
# cleanup - delete created tags and branches as we are in an innerloop on
407408
# the same repository
408409
TagReference.delete(rw_repo,new_tag,other_tag)
409-
remote.push(":%s"%other_tag.path,timeout=10.0)
410+
remote.push(":%s"%other_tag.path,kill_after_timeout=10.0)
410411

411412
@skipIf(HIDE_WINDOWS_FREEZE_ERRORS,"FIXME: Freezes!")
412413
@with_rw_and_rw_remote_repo('0.1.6')
@@ -467,7 +468,8 @@ def test_base(self, rw_repo, remote_repo):
467468
# Only for remotes - local cases are the same or less complicated
468469
# as additional progress information will never be emitted
469470
ifremote.name=="daemon_origin":
470-
self._do_test_fetch(remote,rw_repo,remote_repo,timeout=10.0)
471+
self._do_test_fetch(remote,rw_repo,remote_repo,
472+
kill_after_timeout=10.0)
471473
ran_fetch_test=True
472474
# END fetch test
473475

@@ -651,3 +653,15 @@ def test_push_error(self, repo):
651653
rem=repo.remote('origin')
652654
withself.assertRaisesRegex(GitCommandError,"src refspec __BAD_REF__ does not match any"):
653655
rem.push('__BAD_REF__')
656+
657+
658+
classTestTimeouts(TestBase):
659+
@with_rw_repo('HEAD',bare=False)
660+
deftest_timeout_funcs(self,repo):
661+
forfunctionin ["pull","fetch"]:#"can't get push to reliably timeout
662+
f=getattr(repo.remotes.origin,function)
663+
assertfisnotNone# Make sure these functions exist
664+
665+
withself.assertRaisesRegex(GitCommandError,
666+
"kill_after_timeout=0.01 s"):
667+
f(kill_after_timeout=0.01)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp