summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsroet <sanderroet@hotmail.com>2021-09-13 17:59:24 +0200
committerSebastian Thiel <sebastian.thiel@icloud.com>2021-09-18 09:26:28 +0800
commit0a58afea0d7c3ff57916ddd694d052123e29087f (patch)
tree37583419481271e967928c903d163b88af8428bc
parentef0ca654f859d6caaf2a2029cb691d5beec79ed5 (diff)
downloadgitpython-0a58afea0d7c3ff57916ddd694d052123e29087f.tar.gz
update tests and add a comment about different behaviour of 'push' vs 'fetch'
-rw-r--r--git/remote.py2
-rw-r--r--test/test_remote.py20
2 files changed, 19 insertions, 3 deletions
diff --git a/git/remote.py b/git/remote.py
index bfa4db59..9917c431 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -795,6 +795,8 @@ class Remote(LazyMixin, IterableObj):
try:
proc.wait(stderr=stderr_text)
except Exception:
+ # This is different than fetch (which fails if there is any std_err
+ # even if there is an output)
if not output:
raise
elif stderr_text:
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)