Skip to content

Commit

Permalink
Test: Adding a test, if no conventional commits are found
Browse files Browse the repository at this point in the history
  • Loading branch information
y0urself committed Aug 30, 2021
1 parent 28b85ae commit 5e1d059
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pontos/changelog/conventional_commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def sort_commits(self, commits: List[str]):
else:
warning("No conventional commits found.")
sys.exit(1)
if commit_dict == {}:
warning("No conventional commits found.")
sys.exit(1)
return commit_dict

def build_changelog_file(self, commit_dict: Dict):
Expand Down
7 changes: 5 additions & 2 deletions tests/changelog/test_conventional_commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from pathlib import Path
import unittest
from dataclasses import dataclass
from datetime import datetime

from pontos.terminal import _set_terminal
from pontos.terminal.terminal import Terminal
Expand All @@ -37,6 +38,8 @@ def test_changelog_builder(self):

_set_terminal(Terminal())

today = datetime.today().strftime('%Y-%m-%d')

own_path = Path(__file__).absolute().parent
print(own_path)
config_toml = own_path / 'changelog.toml'
Expand Down Expand Up @@ -70,11 +73,11 @@ def runner(cmd):
shell_cmd_runner=runner,
args=cargs,
)
expected_output = """# Changelog
expected_output = f"""# Changelog
All notable changes to this project will be documented in this file.
## [0.0.2] - 2021-08-25
## [0.0.2] - {today}
## Added
Expand Down

0 comments on commit 5e1d059

Please sign in to comment.