diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-02-13 19:48:40 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-02-13 19:48:40 +0100 |
commit | 15ee0ac0d56a5fb5ba13fae4288621ddd2185f17 (patch) | |
tree | acdf245dfc10162680e16885f182f6b4a3c81b7e /test/git/test_repo.py | |
parent | 400d728c99ddeae73c608e244bd301248b5467fc (diff) | |
download | gitpython-15ee0ac0d56a5fb5ba13fae4288621ddd2185f17.tar.gz |
IndexFile: unmerged_blobs lists are now sorted
Repo.init: fixed incorrect use of the path which was to optionally specify where to initialize the repository. Update test as well
Diffstat (limited to 'test/git/test_repo.py')
-rw-r--r-- | test/git/test_repo.py | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/test/git/test_repo.py b/test/git/test_repo.py index 0e913ff1..4af9161c 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -9,6 +9,7 @@ from test.testlib import * from git import * from git.utils import join_path_native import tempfile +import shutil class TestRepo(TestBase): @@ -90,17 +91,33 @@ class TestRepo(TestBase): assert num_trees == mc - @patch_object(Repo, '__init__') - @patch_object(Git, '_call_process') - def test_init(self, git, repo): - git.return_value = True - repo.return_value = None - - r = Repo.init("repos/foo/bar.git", bare=True) - assert isinstance(r, Repo) - - assert_true(git.called) - assert_true(repo.called) + def test_init(self): + prev_cwd = os.getcwd() + os.chdir(tempfile.gettempdir()) + git_dir_rela = "repos/foo/bar.git" + del_dir_abs = os.path.abspath("repos") + git_dir_abs = os.path.abspath(git_dir_rela) + try: + # with specific path + for path in (git_dir_rela, git_dir_abs): + r = Repo.init(path=path, bare=True) + assert isinstance(r, Repo) + assert r.bare == True + assert os.path.isdir(r.git_dir) + shutil.rmtree(git_dir_abs) + # END for each path + + os.makedirs(git_dir_rela) + os.chdir(git_dir_rela) + r = Repo.init(bare=False) + r.bare == False + finally: + try: + shutil.rmtree(del_dir_abs) + except OSError: + pass + os.chdir(prev_cwd) + # END restore previous state def test_bare_property(self): self.rorepo.bare |