-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d2f456
commit c5c13fb
Showing
4 changed files
with
139 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ def semver(request): | |
|
||
yield SemVer(major, minor, patch) | ||
|
||
|
||
@pytest.fixture | ||
def actor(): | ||
git_actor = git.Actor("pytest-actor", "[email protected]") | ||
|
@@ -22,14 +23,18 @@ def actor(): | |
@pytest.fixture | ||
def repo(request, tmpdir, semver, actor): | ||
if hasattr(request, "param"): | ||
tags = request.param['tags'] | ||
tags = request.param["tags"] | ||
else: | ||
tags = [str(semver)] | ||
|
||
tmprepo = git.Repo.init(tmpdir) | ||
|
||
for f in tags: | ||
tmprepo.index.commit(f"empty commit to enable a tag with name {f}", author=actor) | ||
tmprepo.index.commit( | ||
f"empty commit to enable a tag with name {f}", author=actor | ||
) | ||
tmprepo.create_tag(f, message="Test tag created by pytest") | ||
|
||
setattr(tmprepo, "_tag", semver) | ||
|
||
yield tmprepo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import sys | ||
|
||
from git_release.git_release import find_git_cliff | ||
|
||
|
||
def test_in_path(tmpdir): | ||
path = tmpdir | ||
bin_path = tmpdir / "git-cliff" | ||
with open(bin_path, "w") as f: | ||
f.write("empty") | ||
|
||
assert find_git_cliff(str(path)) == bin_path | ||
|
||
|
||
def test_not_in_path(): | ||
assert find_git_cliff("") is None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from git_release.git_release import find_git_cliff, generate_git_cliff_changelog | ||
|
||
|
||
def test_valid(repo): | ||
generate_git_cliff_changelog(repo._tag, find_git_cliff()) |