예제 #1
0
 def test_minor_reset_patch(self):
     expect = VersionBump('version-1.10.0', minor=True)
     annotator = Annotator(OPTIONS)
     commit_hashes = ['a', 'b', 'z']
     commit_msgs = [
         'a\n\nfix(stuff): I fixed some more stuff.',
         'b\n\nfeat(stuff): I added a sweet new feature.',
         'z\n\nfix(stuff): I fixed some stuff.'
     ]
     prev_version = CommitTag('z refs/tag/version-1.9.4')
     result = annotator.bump_semver(prev_version, commit_hashes,
                                    commit_msgs)
     self.assertEqual(expect, result)
예제 #2
0
 def test_major_reset_version(self):
     expect = VersionBump('version-2.0.0', major=True)
     annotator = Annotator(OPTIONS)
     commit_hashes = ['a', 'b', 'z']
     commit_msgs = [
         'a\n\nfix(stuff): I fixed some more stuff.',
         'b\n\nfeat(stuff): I added a sweet new feature.\n\nBREAKING CHANGE: This breaks stuff really bad.',
         'z\n\nfix(stuff): I fixed some stuff.'
     ]
     prev_version = CommitTag('z refs/tag/version-1.9.4')
     result = annotator.bump_semver(prev_version, commit_hashes,
                                    commit_msgs)
     self.assertEqual(expect, result)
예제 #3
0
class SourceAnnotatorTest(unittest.TestCase):

    PREV_VERSION = CommitTag('z refs/tag/version-1.0.0')

    def test_patch_version(self):
        expect = VersionBump('version-1.0.1', patch=True)
        annotator = Annotator(OPTIONS)
        commit_hashes = ['a', 'z']
        commit_msgs = [
            'a\n\nfix(stuff): I fixed some more stuff.',
            'z\n\nfix(stuff): I fixed some stuff.'
        ]
        result = annotator.bump_semver(self.PREV_VERSION, commit_hashes,
                                       commit_msgs)
        self.assertEqual(expect, result)

    def test_minor_version(self):
        expect = VersionBump('version-1.1.0', minor=True)
        annotator = Annotator(OPTIONS)
        commit_hashes = ['a', 'b', 'z']
        commit_msgs = [
            'a\n\nfix(stuff): I fixed some more stuff.',
            'b\n\nfeat(stuff): I added a sweet new feature.',
            'z\n\nfix(stuff): I fixed some stuff.'
        ]
        result = annotator.bump_semver(self.PREV_VERSION, commit_hashes,
                                       commit_msgs)
        self.assertEqual(expect, result)

    def test_minor_two_digit_version(self):
        expect = VersionBump('version-1.10.0', minor=True)
        annotator = Annotator(OPTIONS)
        commit_hashes = ['a', 'b', 'z']
        commit_msgs = [
            'a\n\nfix(stuff): I fixed some more stuff.',
            'b\n\nfeat(stuff): I added a sweet new feature.',
            'z\n\nfix(stuff): I fixed some stuff.'
        ]
        prev_version = CommitTag('z refs/tag/version-1.9.0')
        result = annotator.bump_semver(prev_version, commit_hashes,
                                       commit_msgs)
        self.assertEqual(expect, result)

    def test_minor_reset_patch(self):
        expect = VersionBump('version-1.10.0', minor=True)
        annotator = Annotator(OPTIONS)
        commit_hashes = ['a', 'b', 'z']
        commit_msgs = [
            'a\n\nfix(stuff): I fixed some more stuff.',
            'b\n\nfeat(stuff): I added a sweet new feature.',
            'z\n\nfix(stuff): I fixed some stuff.'
        ]
        prev_version = CommitTag('z refs/tag/version-1.9.4')
        result = annotator.bump_semver(prev_version, commit_hashes,
                                       commit_msgs)
        self.assertEqual(expect, result)

    def test_major_version(self):
        expect = VersionBump('version-2.0.0', major=True)
        annotator = Annotator(OPTIONS)
        commit_hashes = ['a', 'b', 'z']
        commit_msgs = [
            'a\n\nfix(stuff): I fixed some more stuff.',
            'b\n\nfeat(stuff): I added a sweet new feature.\n\nBREAKING CHANGE: This breaks stuff really bad.',
            'z\n\nfix(stuff): I fixed some stuff.'
        ]
        result = annotator.bump_semver(self.PREV_VERSION, commit_hashes,
                                       commit_msgs)
        self.assertEqual(expect, result)

    def test_major_reset_version(self):
        expect = VersionBump('version-2.0.0', major=True)
        annotator = Annotator(OPTIONS)
        commit_hashes = ['a', 'b', 'z']
        commit_msgs = [
            'a\n\nfix(stuff): I fixed some more stuff.',
            'b\n\nfeat(stuff): I added a sweet new feature.\n\nBREAKING CHANGE: This breaks stuff really bad.',
            'z\n\nfix(stuff): I fixed some stuff.'
        ]
        prev_version = CommitTag('z refs/tag/version-1.9.4')
        result = annotator.bump_semver(prev_version, commit_hashes,
                                       commit_msgs)
        self.assertEqual(expect, result)

    def test_major_reset_version(self):
        expect = VersionBump('version-2.0.0', major=True)
        annotator = Annotator(OPTIONS)
        commit_hashes = ['a', 'b', 'z']
        commit_msgs = [
            'a\n\nfix(stuff): I fixed some more stuff.',
            'b\n\nfeat(stuff): I added a sweet new feature.\n\nBREAKING CHANGE: This breaks stuff really bad.',
            'z\n\nfix(stuff): I fixed some stuff.'
        ]
        prev_version = CommitTag('z refs/tag/version-1.9.0')
        result = annotator.bump_semver(prev_version, commit_hashes,
                                       commit_msgs)
        self.assertEqual(expect, result)

    def test_default_msgs(self):
        expect = VersionBump('version-1.0.1', patch=True)
        annotator = Annotator(OPTIONS)
        commit_hashes = ['a', 'z']
        commit_msgs = [
            'a\n\nI fixed some more stuff.', 'z\n\nI fixed some stuff.'
        ]
        result = annotator.bump_semver(self.PREV_VERSION, commit_hashes,
                                       commit_msgs)
        self.assertEqual(expect, result)