def test_extract5(): e1 = extract("feat(ssccooppee): feature X fixed") assert e1['type'] == "feat" assert e1['scope'] == "ssccooppee" assert e1['description'] == "feature X fixed" assert e1['body_and_footer'] == "" assert e1['breaking'] == False
def test_extract1(): e1 = extract("feat: feature X fixed") assert e1['type'] == "feat" assert e1['scope'] is None assert e1['description'] == "feature X fixed" assert e1['body_and_footer'] == "" assert e1['breaking'] == False
def test_extract4(): e1 = extract("feat: feature X fixed\n\nbody body\n\nBREAKING CHANGE: footerfooter\n") assert e1['type'] == "feat" assert e1['scope'] is None assert e1['description'] == "feature X fixed" assert e1['body_and_footer'] == "\nbody body\n\nBREAKING CHANGE: footerfooter\n" assert e1['breaking'] == True
def test_extract3(): e1 = extract("feat: feature X fixed\n\nbody body\n\nfooterfooter\n") assert e1['type'] == "feat" assert e1['scope'] is None assert e1['description'] == "feature X fixed" assert e1['body_and_footer'] == "\nbody body\n\nfooterfooter\n" assert e1['breaking'] == False
#!/Users/kasterma/projects/automation/convcommit/venv/bin/python # # example commit-mst that prints the result of the parsing # rename to commit-msg, make executable, and place in .git/hooks/ import sys from convc import extract print(sys.argv) with open(sys.argv[1], 'r') as commit_message_file: commit_msg = commit_message_file.read() print(extract(commit_msg)) parsed_commit = extract(commit_msg) if parsed_commit['type'] == 'nono': print("ERROR: can't use type 'nono'") sys.exit(23)