summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/git/test_base.py6
-rw-r--r--test/git/test_index.py14
-rw-r--r--test/git/test_refs.py2
-rw-r--r--test/git/test_remote.py4
-rw-r--r--test/git/test_repo.py12
-rw-r--r--test/testlib/helper.py2
6 files changed, 20 insertions, 20 deletions
diff --git a/test/git/test_base.py b/test/git/test_base.py
index ab46ded4..ec85c2a7 100644
--- a/test/git/test_base.py
+++ b/test/git/test_base.py
@@ -84,15 +84,15 @@ class TestBase(TestBase):
@with_bare_rw_repo
def test_with_bare_rw_repo(self, bare_rw_repo):
assert bare_rw_repo.config_reader("repository").getboolean("core", "bare")
- assert os.path.isfile(os.path.join(bare_rw_repo.path,'HEAD'))
+ assert os.path.isfile(os.path.join(bare_rw_repo.git_dir,'HEAD'))
@with_rw_repo('0.1.6')
def test_with_rw_repo(self, rw_repo):
assert not rw_repo.config_reader("repository").getboolean("core", "bare")
- assert os.path.isdir(os.path.join(rw_repo.git.git_dir,'lib'))
+ assert os.path.isdir(os.path.join(rw_repo.working_tree_dir,'lib'))
@with_rw_and_rw_remote_repo('0.1.6')
def test_with_rw_remote_and_rw_repo(self, rw_repo, rw_remote_repo):
assert not rw_repo.config_reader("repository").getboolean("core", "bare")
assert rw_remote_repo.config_reader("repository").getboolean("core", "bare")
- assert os.path.isdir(os.path.join(rw_repo.git.git_dir,'lib'))
+ assert os.path.isdir(os.path.join(rw_repo.working_tree_dir,'lib'))
diff --git a/test/git/test_index.py b/test/git/test_index.py
index 3a7edc7e..459cfc0e 100644
--- a/test/git/test_index.py
+++ b/test/git/test_index.py
@@ -254,7 +254,7 @@ class TestTree(TestBase):
# reset the working copy as well to current head,to pull 'back' as well
new_data = "will be reverted"
- file_path = os.path.join(rw_repo.git.git_dir, "CHANGES")
+ file_path = os.path.join(rw_repo.working_tree_dir, "CHANGES")
fp = open(file_path, "wb")
fp.write(new_data)
fp.close()
@@ -269,7 +269,7 @@ class TestTree(TestBase):
fp.close()
# test full checkout
- test_file = os.path.join(rw_repo.git.git_dir, "CHANGES")
+ test_file = os.path.join(rw_repo.working_tree_dir, "CHANGES")
open(test_file, 'ab').write("some data")
rval = index.checkout(None, force=True, fprogress=self._fprogress)
assert 'CHANGES' in list(rval)
@@ -312,7 +312,7 @@ class TestTree(TestBase):
assert not open(test_file).read().endswith(append_data)
# checkout directory
- shutil.rmtree(os.path.join(rw_repo.git.git_dir, "lib"))
+ shutil.rmtree(os.path.join(rw_repo.working_tree_dir, "lib"))
rval = index.checkout('lib')
assert len(list(rval)) > 1
@@ -321,7 +321,7 @@ class TestTree(TestBase):
Returns count of files that actually exist in the repository directory.
"""
existing = 0
- basedir = repo.git.git_dir
+ basedir = repo.working_tree_dir
for f in files:
existing += os.path.isfile(os.path.join(basedir, f))
# END for each deleted file
@@ -375,7 +375,7 @@ class TestTree(TestBase):
self.failUnlessRaises(TypeError, index.remove, [1])
# absolute path
- deleted_files = index.remove([os.path.join(rw_repo.git.git_dir,"lib")], r=True)
+ deleted_files = index.remove([os.path.join(rw_repo.working_tree_dir,"lib")], r=True)
assert len(deleted_files) > 1
self.failUnlessRaises(ValueError, index.remove, ["/doesnt/exists"])
@@ -411,7 +411,7 @@ class TestTree(TestBase):
index.reset(new_commit.parents[0], working_tree=True).reset(new_commit, working_tree=False)
lib_file_path = "lib/git/__init__.py"
assert (lib_file_path, 0) not in index.entries
- assert os.path.isfile(os.path.join(rw_repo.git.git_dir, lib_file_path))
+ assert os.path.isfile(os.path.join(rw_repo.working_tree_dir, lib_file_path))
# directory
entries = index.add(['lib'], fprogress=self._fprogress_add)
@@ -452,7 +452,7 @@ class TestTree(TestBase):
# add symlink
if sys.platform != "win32":
- link_file = os.path.join(rw_repo.git.git_dir, "my_real_symlink")
+ link_file = os.path.join(rw_repo.working_tree_dir, "my_real_symlink")
os.symlink("/etc/that", link_file)
entries = index.reset(new_commit).add([link_file], fprogress=self._fprogress_add)
self._assert_fprogress(entries)
diff --git a/test/git/test_refs.py b/test/git/test_refs.py
index 55982b23..13297512 100644
--- a/test/git/test_refs.py
+++ b/test/git/test_refs.py
@@ -271,7 +271,7 @@ class TestRefs(TestBase):
symbol_ref_path = "refs/symbol_ref"
symref = SymbolicReference(rw_repo, symbol_ref_path)
assert symref.path == symbol_ref_path
- symbol_ref_abspath = os.path.join(rw_repo.path, symref.path)
+ symbol_ref_abspath = os.path.join(rw_repo.git_dir, symref.path)
# set it
symref.reference = new_head
diff --git a/test/git/test_remote.py b/test/git/test_remote.py
index 4849dfd0..edbf758c 100644
--- a/test/git/test_remote.py
+++ b/test/git/test_remote.py
@@ -62,7 +62,7 @@ class TestPushProgress(PushProgress):
class TestRemote(TestBase):
def _print_fetchhead(self, repo):
- fp = open(os.path.join(repo.path, "FETCH_HEAD"))
+ fp = open(os.path.join(repo.git_dir, "FETCH_HEAD"))
fp.close()
@@ -213,7 +213,7 @@ class TestRemote(TestBase):
# must clone with a local path for the repo implementation not to freak out
# as it wants local paths only ( which I can understand )
other_repo = remote_repo.clone(other_repo_dir, shared=False)
- remote_repo_url = "git://localhost%s"%remote_repo.path
+ remote_repo_url = "git://localhost%s"%remote_repo.git_dir
# put origin to git-url
other_origin = other_repo.remotes.origin
diff --git a/test/git/test_repo.py b/test/git/test_repo.py
index e94a45bd..0e913ff1 100644
--- a/test/git/test_repo.py
+++ b/test/git/test_repo.py
@@ -21,11 +21,11 @@ class TestRepo(TestBase):
Repo("repos/foobar")
def test_repo_creation_from_different_paths(self):
- r_from_gitdir = Repo(self.rorepo.path)
- assert r_from_gitdir.path == self.rorepo.path
- assert r_from_gitdir.path.endswith('.git')
- assert not self.rorepo.git.git_dir.endswith('.git')
- assert r_from_gitdir.git.git_dir == self.rorepo.git.git_dir
+ r_from_gitdir = Repo(self.rorepo.git_dir)
+ assert r_from_gitdir.git_dir == self.rorepo.git_dir
+ assert r_from_gitdir.git_dir.endswith('.git')
+ assert not self.rorepo.git.working_dir.endswith('.git')
+ assert r_from_gitdir.git.working_dir == self.rorepo.git.working_dir
def test_description(self):
txt = "Test repository"
@@ -225,7 +225,7 @@ class TestRepo(TestBase):
assert_true( len( tlist ) < sum( len(t) for t in tlist ) ) # test for single-char bug
def test_untracked_files(self):
- base = self.rorepo.git.git_dir
+ base = self.rorepo.working_tree_dir
files = ( join_path_native(base, "__test_myfile"),
join_path_native(base, "__test_other_file") )
num_recently_untracked = 0
diff --git a/test/testlib/helper.py b/test/testlib/helper.py
index e33961a7..da4a4207 100644
--- a/test/testlib/helper.py
+++ b/test/testlib/helper.py
@@ -241,7 +241,7 @@ class TestBase(TestCase):
with the given data. Returns absolute path to created file.
"""
repo = repo or self.rorepo
- abs_path = os.path.join(repo.git.git_dir, rela_path)
+ abs_path = os.path.join(repo.working_tree_dir, rela_path)
fp = open(abs_path, "w")
fp.write(data)
fp.close()