summaryrefslogtreecommitdiff
path: root/test/test_refs.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_refs.py')
-rw-r--r--test/test_refs.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/test/test_refs.py b/test/test_refs.py
index f0d648f1..fefce6be 100644
--- a/test/test_refs.py
+++ b/test/test_refs.py
@@ -15,7 +15,7 @@ import os
class TestRefs(TestBase):
- def _test_from_path(self):
+ def test_from_path(self):
# should be able to create any reference directly
for ref_type in ( Reference, Head, TagReference, RemoteReference ):
for name in ('rela_name', 'path/rela_name'):
@@ -25,7 +25,7 @@ class TestRefs(TestBase):
# END for each name
# END for each type
- def _test_tag_base(self):
+ def test_tag_base(self):
tag_object_refs = list()
for tag in self.rorepo.tags:
assert "refs/tags" in tag.path
@@ -50,7 +50,7 @@ class TestRefs(TestBase):
assert tag_object_refs
assert isinstance(self.rorepo.tags['0.1.5'], TagReference)
- def _test_tags(self):
+ def test_tags(self):
# tag refs can point to tag objects or to commits
s = set()
ref_count = 0
@@ -67,7 +67,7 @@ class TestRefs(TestBase):
assert len(s|s) == ref_count
@with_rw_repo('HEAD', bare=False)
- def _test_heads(self, rwrepo):
+ def test_heads(self, rwrepo):
for head in rwrepo.heads:
assert head.name
assert head.path
@@ -129,7 +129,7 @@ class TestRefs(TestBase):
# TODO: Need changing a ref changes HEAD reflog as well if it pointed to it
- def _test_refs(self):
+ def test_refs(self):
types_found = set()
for ref in self.rorepo.refs:
types_found.add(type(ref))
@@ -142,7 +142,7 @@ class TestRefs(TestBase):
assert SymbolicReference(self.rorepo, 'hellothere').is_valid() == False
@with_rw_repo('0.1.6')
- def _test_head_reset(self, rw_repo):
+ def test_head_reset(self, rw_repo):
cur_head = rw_repo.head
old_head_commit = cur_head.commit
new_head_commit = cur_head.ref.commit.parents[0]
@@ -292,7 +292,11 @@ class TestRefs(TestBase):
head_tree = head.commit.tree
self.failUnlessRaises(ValueError, setattr, head, 'commit', head_tree)
assert head.commit == old_commit # and the ref did not change
- self.failUnlessRaises(GitCommandError, setattr, head, 'object', head_tree)
+ # we allow heds to point to any object
+ head.object = head_tree
+ assert head.object == head_tree
+ # cannot query tree as commit
+ self.failUnlessRaises(TypeError, getattr, head, 'commit')
# set the commit directly using the head. This would never detach the head
assert not cur_head.is_detached
@@ -488,20 +492,20 @@ class TestRefs(TestBase):
Reference.delete(ref.repo, ref.path)
assert not ref.is_valid()
- self.failUnlessRaises(GitCommandError, setattr, ref, 'object', "nonsense")
+ self.failUnlessRaises(ValueError, setattr, ref, 'object', "nonsense")
assert not ref.is_valid()
# END for each path
- def _test_dereference_recursive(self):
+ def test_dereference_recursive(self):
# for now, just test the HEAD
assert SymbolicReference.dereference_recursive(self.rorepo, 'HEAD')
- def _test_reflog(self):
+ def test_reflog(self):
assert isinstance(self.rorepo.heads.master.log(), RefLog)
- def _test_todo(self):
+ def test_todo(self):
# delete deletes the reflog
# create creates a new entry
# set_reference and set_commit and set_object use the reflog if message is given