Commit 9fbc0318 authored by Plup's avatar Plup

Merge branch 'feature/enable-pre-release-branch' into 'master'

Feature/enable pre release branch

See merge request !1
parents 07e842b1 f7aeddd6
*.pyc
*.egg-info
*.eggs
venv
.venv
#IDE settings
.idea/
......@@ -24,6 +24,7 @@ TYPES = {
'other': 'other',
}
def parse_commit_message(message: str) -> Tuple[int, str, str, Tuple[str, str, str]]:
"""
Parses a commit message according to the StartinBlox rules to define release
......@@ -34,7 +35,7 @@ def parse_commit_message(message: str) -> Tuple[int, str, str, Tuple[str, str, s
# parse message
parsed = re_parser.match(message)
if not parsed:
raise UnknownCommitMessageStyleError(
raise UnknownCommitMessageStyleError(
'Unable to parse the given commit message: {}'.format(message)
)
......@@ -54,7 +55,7 @@ def parse_commit_message(message: str) -> Tuple[int, str, str, Tuple[str, str, s
# set type to 'other' by default
_type = TYPES['other']
if parsed.group('type') in TYPES:
_type = TYPES[parsed.group('type')]
_type = TYPES[parsed.group('type')]
return (
level_bump,
......
import sys
import unittest
import commit_parser.parser
import semantic_release
from commit_parser.parser import TYPES
class TestParser(unittest.TestCase):
def test_parse_commit_message(self):
with self.assertRaises(semantic_release.errors.UnknownCommitMessageStyleError):
commit_parser.parser.parse_commit_message("my dummy commit message")
def test_parse_commit_message_other_type(self):
result = commit_parser.parser.parse_commit_message("test: trigger pipeline")
expected = (1, TYPES['other'], '', ("trigger pipeline", '',''))
self.assertEqual(result, expected)
def test_parse_commit_message_major_type(self):
result = commit_parser.parser.parse_commit_message("major: trigger pipeline")
expected = (3, TYPES['major'], '', ("trigger pipeline", '',''))
self.assertEqual(result, expected)
def test_parse_commit_message_minor_type(self):
result = commit_parser.parser.parse_commit_message("minor: add multi provider login")
expected = (2, TYPES['minor'], '', ("add multi provider login", '',''))
self.assertEqual(result, expected)
def test_parse_commit_message_feature_type(self):
result = commit_parser.parser.parse_commit_message("feature: settings attributs are now passed to element")
expected = (1, TYPES['feature'], '', ("settings attributs are now passed to element", '', ''))
self.assertEqual(result, expected)
def test_parse_commit_message_update_type(self):
result = commit_parser.parser.parse_commit_message("update: this is an update")
expected = (1, TYPES['update'], '', ("this is an update", '', ''))
self.assertEqual(result, expected)
def test_parse_commit_message_bugfix_type(self):
result = commit_parser.parser.parse_commit_message("bugfix: this is a bugfix")
expected = (1, TYPES['bugfix'], '', ("this is a bugfix", '', ''))
self.assertEqual(result, expected)
def test_parse_commit_message_ui_type(self):
result = commit_parser.parser.parse_commit_message("ui: here comes the new UI")
expected = (1, TYPES['ui'], '', ("here comes the new UI", '', ''))
self.assertEqual(result, expected)
def test_parse_commit_message_syntax_type(self):
result = commit_parser.parser.parse_commit_message("syntax: just a typo !")
expected = (1, TYPES['syntax'], '', ("just a typo !", '', ''))
self.assertEqual(result, expected)
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment