summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostis Anagnostopoulos <ankostis@gmail.com>2016-09-25 18:08:16 +0200
committerKostis Anagnostopoulos <ankostis@gmail.com>2016-09-26 13:37:16 +0200
commit51bf7cbe8216d9a1da723c59b6feece0b1a34589 (patch)
tree3d64fafd239f428717565c68db234f6db610c31c
parent1210ec763e1935b95a3a909c61998fbd251b7575 (diff)
downloadgitpython-51bf7cbe8216d9a1da723c59b6feece0b1a34589.tar.gz
win: GC.collect on all TC.tearDown to fix appveyor hang runs
+ Fixed the hangs at `test_git:TestGit.test_handle_process_output()`. [travisci skip]
-rw-r--r--git/test/lib/helper.py2
-rw-r--r--git/test/performance/test_commit.py4
-rw-r--r--git/test/test_base.py4
-rw-r--r--git/test/test_diff.py8
-rw-r--r--git/test/test_docs.py7
-rw-r--r--git/test/test_git.py4
-rw-r--r--git/test/test_remote.py4
-rw-r--r--git/test/test_repo.py4
-rw-r--r--git/test/test_submodule.py4
9 files changed, 38 insertions, 3 deletions
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py
index 8be2881c..9488005f 100644
--- a/git/test/lib/helper.py
+++ b/git/test/lib/helper.py
@@ -299,6 +299,8 @@ class TestBase(TestCase):
Dynamically add a read-only repository to our actual type. This way
each test type has its own repository
"""
+ import gc
+ gc.collect()
cls.rorepo = Repo(GIT_REPO)
@classmethod
diff --git a/git/test/performance/test_commit.py b/git/test/performance/test_commit.py
index b59c747e..c60dc2fc 100644
--- a/git/test/performance/test_commit.py
+++ b/git/test/performance/test_commit.py
@@ -17,6 +17,10 @@ from git.test.test_commit import assert_commit_serialization
class TestPerformance(TestBigRepoRW):
+ def tearDown(self):
+ import gc
+ gc.collect()
+
# ref with about 100 commits in its history
ref_100 = '0.1.6'
diff --git a/git/test/test_base.py b/git/test/test_base.py
index 7b71a77e..c17e04e7 100644
--- a/git/test/test_base.py
+++ b/git/test/test_base.py
@@ -27,6 +27,10 @@ from gitdb.util import hex_to_bin
class TestBase(TestBase):
+ def tearDown(self):
+ import gc
+ gc.collect()
+
type_tuples = (("blob", "8741fc1d09d61f02ffd8cded15ff603eff1ec070", "blob.py"),
("tree", "3a6a5e3eeed3723c09f1ef0399f81ed6b8d82e79", "directory"),
("commit", "4251bd59fb8e11e40c40548cba38180a9536118c", None),
diff --git a/git/test/test_diff.py b/git/test/test_diff.py
index 9fdb26a2..8735dfc4 100644
--- a/git/test/test_diff.py
+++ b/git/test/test_diff.py
@@ -28,6 +28,10 @@ from git import (
class TestDiff(TestBase):
+ def tearDown(self):
+ import gc
+ gc.collect()
+
def _assert_diff_format(self, diffs):
# verify that the format of the diff is sane
for diff in diffs:
@@ -107,12 +111,12 @@ class TestDiff(TestBase):
def test_diff_of_modified_files_not_added_to_the_index(self):
output = StringProcessAdapter(fixture('diff_abbrev-40_full-index_M_raw_no-color'))
diffs = Diff._index_from_raw_format(self.rorepo, output.stdout)
-
+
assert len(diffs) == 1, 'one modification'
assert len(list(diffs.iter_change_type('M'))) == 1, 'one modification'
assert diffs[0].change_type == 'M'
assert diffs[0].b_blob is None
-
+
def test_binary_diff(self):
for method, file_name in ((Diff._index_from_patch_format, 'diff_patch_binary'),
(Diff._index_from_raw_format, 'diff_raw_binary')):
diff --git a/git/test/test_docs.py b/git/test/test_docs.py
index b297363d..2cd355b2 100644
--- a/git/test/test_docs.py
+++ b/git/test/test_docs.py
@@ -11,6 +11,11 @@ from gitdb.test.lib import with_rw_directory
class Tutorials(TestBase):
+
+ def tearDown(self):
+ import gc
+ gc.collect()
+
@with_rw_directory
def test_init_repo_object(self, rw_dir):
# [1-test_init_repo_object]
@@ -64,7 +69,7 @@ class Tutorials(TestBase):
assert repo.head.ref == repo.heads.master # head is a symbolic reference pointing to master
assert repo.tags['0.3.5'] == repo.tag('refs/tags/0.3.5') # you can access tags in various ways too
assert repo.refs.master == repo.heads['master'] # .refs provides access to all refs, i.e. heads ...
-
+
if 'TRAVIS' not in os.environ:
assert repo.refs['origin/master'] == repo.remotes.origin.refs.master # ... remotes ...
assert repo.refs['0.3.5'] == repo.tags['0.3.5'] # ... and tags
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 59796a3d..534539d7 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -40,6 +40,10 @@ class TestGit(TestBase):
super(TestGit, cls).setUpClass()
cls.git = Git(cls.rorepo.working_dir)
+ def tearDown(self):
+ import gc
+ gc.collect()
+
@patch.object(Git, 'execute')
def test_call_process_calls_execute(self, git):
git.return_value = ''
diff --git a/git/test/test_remote.py b/git/test/test_remote.py
index 3c2e622d..70c4a596 100644
--- a/git/test/test_remote.py
+++ b/git/test/test_remote.py
@@ -101,6 +101,10 @@ class TestRemoteProgress(RemoteProgress):
class TestRemote(TestBase):
+ def tearDown(self):
+ import gc
+ gc.collect()
+
def _print_fetchhead(self, repo):
fp = open(os.path.join(repo.git_dir, "FETCH_HEAD"))
fp.close()
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index d04a0f66..abc4a704 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -64,6 +64,10 @@ def flatten(lol):
class TestRepo(TestBase):
+ def tearDown(self):
+ import gc
+ gc.collect()
+
@raises(InvalidGitRepositoryError)
def test_new_should_raise_on_invalid_repo_location(self):
Repo(tempfile.gettempdir())
diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py
index 17ce605a..881dd7e6 100644
--- a/git/test/test_submodule.py
+++ b/git/test/test_submodule.py
@@ -49,6 +49,10 @@ prog = TestRootProgress()
class TestSubmodule(TestBase):
+ def tearDown(self):
+ import gc
+ gc.collect()
+
k_subm_current = "c15a6e1923a14bc760851913858a3942a4193cdb"
k_subm_changed = "394ed7006ee5dc8bddfd132b64001d5dfc0ffdd3"
k_no_subm_tag = "0.1.6"