diff options
author | sroet <sanderroet@hotmail.com> | 2021-09-13 17:59:24 +0200 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-09-18 09:26:28 +0800 |
commit | 0a58afea0d7c3ff57916ddd694d052123e29087f (patch) | |
tree | 37583419481271e967928c903d163b88af8428bc /test/test_remote.py | |
parent | ef0ca654f859d6caaf2a2029cb691d5beec79ed5 (diff) | |
download | gitpython-0a58afea0d7c3ff57916ddd694d052123e29087f.tar.gz |
update tests and add a comment about different behaviour of 'push' vs 'fetch'
Diffstat (limited to 'test/test_remote.py')
-rw-r--r-- | test/test_remote.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/test/test_remote.py b/test/test_remote.py index e5fe8dd0..1cbc2eb2 100644 --- a/test/test_remote.py +++ b/test/test_remote.py @@ -6,6 +6,7 @@ import random import tempfile +import pytest from unittest import skipIf from git import ( @@ -401,12 +402,12 @@ class TestRemote(TestBase): res = remote.push(all=True) self._do_test_push_result(res, remote) - remote.pull('master', timeout=10.0) + remote.pull('master', kill_after_timeout=10.0) # cleanup - delete created tags and branches as we are in an innerloop on # the same repository TagReference.delete(rw_repo, new_tag, other_tag) - remote.push(":%s" % other_tag.path, timeout=10.0) + remote.push(":%s" % other_tag.path, kill_after_timeout=10.0) @skipIf(HIDE_WINDOWS_FREEZE_ERRORS, "FIXME: Freezes!") @with_rw_and_rw_remote_repo('0.1.6') @@ -467,7 +468,8 @@ class TestRemote(TestBase): # Only for remotes - local cases are the same or less complicated # as additional progress information will never be emitted if remote.name == "daemon_origin": - self._do_test_fetch(remote, rw_repo, remote_repo, timeout=10.0) + self._do_test_fetch(remote, rw_repo, remote_repo, + kill_after_timeout=10.0) ran_fetch_test = True # END fetch test @@ -651,3 +653,15 @@ class TestRemote(TestBase): rem = repo.remote('origin') with self.assertRaisesRegex(GitCommandError, "src refspec __BAD_REF__ does not match any"): rem.push('__BAD_REF__') + + +class TestTimeouts(TestBase): + @with_rw_repo('HEAD', bare=False) + def test_timeout_funcs(self, repo): + for function in ["pull", "fetch"]: #"can't get push to reliably timeout + f = getattr(repo.remotes.origin, function) + assert f is not None # Make sure these functions exist + + with self.assertRaisesRegex(GitCommandError, + "kill_after_timeout=0.01 s"): + f(kill_after_timeout=0.01) |