|
6 | 6 |
|
7 | 7 | importrandom
|
8 | 8 | importtempfile
|
| 9 | +importpytest |
9 | 10 | fromunittestimportskipIf
|
10 | 11 |
|
11 | 12 | fromgitimport (
|
@@ -401,12 +402,12 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo):
|
401 | 402 | res=remote.push(all=True)
|
402 | 403 | self._do_test_push_result(res,remote)
|
403 | 404 |
|
404 |
| -remote.pull('master',timeout=10.0) |
| 405 | +remote.pull('master',kill_after_timeout=10.0) |
405 | 406 |
|
406 | 407 | # cleanup - delete created tags and branches as we are in an innerloop on
|
407 | 408 | # the same repository
|
408 | 409 | 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) |
410 | 411 |
|
411 | 412 | @skipIf(HIDE_WINDOWS_FREEZE_ERRORS,"FIXME: Freezes!")
|
412 | 413 | @with_rw_and_rw_remote_repo('0.1.6')
|
@@ -467,7 +468,8 @@ def test_base(self, rw_repo, remote_repo):
|
467 | 468 | # Only for remotes - local cases are the same or less complicated
|
468 | 469 | # as additional progress information will never be emitted
|
469 | 470 | 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) |
471 | 473 | ran_fetch_test=True
|
472 | 474 | # END fetch test
|
473 | 475 |
|
@@ -651,3 +653,15 @@ def test_push_error(self, repo):
|
651 | 653 | rem=repo.remote('origin')
|
652 | 654 | withself.assertRaisesRegex(GitCommandError,"src refspec __BAD_REF__ does not match any"):
|
653 | 655 | 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) |