Changeset - 56e456117510
[Not reviewed]
default
0 1 0
Manuel Jacob - 7 years ago 2019-02-18 23:55:07
me@manueljacob.de
hg: add tests for `successors` and `predecessors` properties of MercurialChangeset

They are marked as xfail because the current implementation fails on new versions of Mercurial because a function and an attribute were renamed.
1 file changed with 10 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/vcs/test_hg.py
Show inline comments
 
@@ -539,48 +539,58 @@ class TestMercurialChangeset(object):
 
        assert path in [rf.path for rf in chset.removed]
 

	
 
    def test_commit_message_is_unicode(self):
 
        for cm in self.repo:
 
            assert type(cm.message) == unicode
 

	
 
    def test_changeset_author_is_unicode(self):
 
        for cm in self.repo:
 
            assert type(cm.author) == unicode
 

	
 
    def test_repo_files_content_is_unicode(self):
 
        test_changeset = self.repo.get_changeset(100)
 
        for node in test_changeset.get_node('/'):
 
            if node.is_file():
 
                assert type(node.content) == unicode
 

	
 
    def test_wrong_path(self):
 
        # There is 'setup.py' in the root dir but not there:
 
        path = 'foo/bar/setup.py'
 
        with pytest.raises(VCSError):
 
            self.repo.get_changeset().get_node(path)
 

	
 
    def test_archival_file(self):
 
        # TODO:
 
        pass
 

	
 
    def test_archival_as_generator(self):
 
        # TODO:
 
        pass
 

	
 
    def test_archival_wrong_kind(self):
 
        tip = self.repo.get_changeset()
 
        with pytest.raises(VCSError):
 
            tip.fill_archive(kind='error')
 

	
 
    def test_archival_empty_prefix(self):
 
        # TODO:
 
        pass
 

	
 
    def test_author_email(self):
 
        assert 'marcin@python-blog.com' == self.repo.get_changeset('b986218ba1c9').author_email
 
        assert 'lukasz.balcerzak@python-center.pl' == self.repo.get_changeset('3803844fdbd3').author_email
 
        assert '' == self.repo.get_changeset('84478366594b').author_email
 

	
 
    def test_author_username(self):
 
        assert 'Marcin Kuzminski' == self.repo.get_changeset('b986218ba1c9').author_name
 
        assert 'Lukasz Balcerzak' == self.repo.get_changeset('3803844fdbd3').author_name
 
        assert 'marcink' == self.repo.get_changeset('84478366594b').author_name
 

	
 
    @pytest.mark.xfail
 
    def test_successors(self):
 
        init_chset = self.repo.get_changeset(0)
 
        assert init_chset.successors == []
 

	
 
    @pytest.mark.xfail
 
    def test_predecessors(self):
 
        init_chset = self.repo.get_changeset(0)
 
        assert init_chset.predecessors == set([])
0 comments (0 inline, 0 general)