diff options
-rw-r--r-- | git/objects/commit.py | 3 | ||||
-rw-r--r-- | git/test/objects/lib.py | 18 | ||||
-rw-r--r-- | git/test/objects/test_blob.py | 6 | ||||
-rw-r--r-- | git/test/objects/test_commit.py | 14 | ||||
-rw-r--r-- | git/test/objects/test_submodule.py | 5 | ||||
-rw-r--r-- | git/test/objects/test_tree.py | 10 |
6 files changed, 41 insertions, 15 deletions
diff --git a/git/objects/commit.py b/git/objects/commit.py index 45a821a1..c201780c 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -14,7 +14,8 @@ from git.util import ( Actor, RepoAliasMixin, Iterable, - Actor + Actor, + Stats ) from util import ( diff --git a/git/test/objects/lib.py b/git/test/objects/lib.py new file mode 100644 index 00000000..c146833d --- /dev/null +++ b/git/test/objects/lib.py @@ -0,0 +1,18 @@ +"""Provide customized obhject testing facilities""" + +from git.test.lib import ( + rorepo_dir, + TestBase, + assert_equal, + assert_not_equal, + with_rw_repo, + StringProcessAdapter, + ) +from git.repo import Repo + +class TestObjectBase(TestBase): + """Provides a default read-only repository in the rorepo member""" + + @classmethod + def setUpAll(cls): + cls.rorepo = Repo(rorepo_dir()) diff --git a/git/test/objects/test_blob.py b/git/test/objects/test_blob.py index a6de7fb7..58ac25b7 100644 --- a/git/test/objects/test_blob.py +++ b/git/test/objects/test_blob.py @@ -4,11 +4,11 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from git.test.lib import TestBase -from git import * +from lib import * +from git.objects.blob import * from git.util import hex_to_bin -class TestBlob(TestBase): +class TestBlob(TestObjectBase): def test_mime_type_should_return_mime_type_for_known_types(self): blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA, 'path': 'foo.png'}) diff --git a/git/test/objects/test_commit.py b/git/test/objects/test_commit.py index 3ccff228..80326fe9 100644 --- a/git/test/objects/test_commit.py +++ b/git/test/objects/test_commit.py @@ -5,10 +5,14 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from git.test.lib import TestBase -from git import * -from git import IStream -from git.util import hex_to_bin +from lib import * +from git.objects.commit import * +from git.base import IStream + +from git.util import ( + hex_to_bin, + Actor, + ) from cStringIO import StringIO import time @@ -65,7 +69,7 @@ def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False) # END handle performance info -class TestCommit(TestBase): +class TestCommit(TestObjectBase): def test_bake(self): diff --git a/git/test/objects/test_submodule.py b/git/test/objects/test_submodule.py index cb5fd33f..b3405a96 100644 --- a/git/test/objects/test_submodule.py +++ b/git/test/objects/test_submodule.py @@ -1,11 +1,12 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from git.test.lib import TestBase +from lib import * from git.exc import * from git.objects.submodule.base import Submodule from git.objects.submodule.root import RootModule, RootUpdateProgress from git.util import to_native_path_linux, join_path_native + import shutil import git import os @@ -18,7 +19,7 @@ class TestRootProgress(RootUpdateProgress): prog = TestRootProgress() -class TestSubmodule(TestBase): +class TestSubmodule(TestObjectBase): k_subm_current = "468cad66ff1f80ddaeee4123c24e4d53a032c00d" k_subm_changed = "394ed7006ee5dc8bddfd132b64001d5dfc0ffdd3" diff --git a/git/test/objects/test_tree.py b/git/test/objects/test_tree.py index af32aeb9..bc8d3f97 100644 --- a/git/test/objects/test_tree.py +++ b/git/test/objects/test_tree.py @@ -4,16 +4,18 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -import os -from git.test.lib import TestBase -from git import * + +from lib import * from git.objects.fun import ( traverse_tree_recursive, traverse_trees_recursive ) +from git.objects.blob import Blob +from git.objects.tree import Tree from cStringIO import StringIO +import os -class TestTree(TestBase): +class TestTree(TestObjectBase): def test_serializable(self): # tree at the given commit contains a submodule as well |