|
| 1 | +import itertools |
1 | 2 | import sys
|
2 | 3 | from datetime import datetime
|
3 | 4 |
|
@@ -660,6 +661,36 @@ def test_changelog_incremental_with_release_candidate_version(
|
660 | 661 | file_regression.check(out, extension=".md")
|
661 | 662 |
|
662 | 663 |
|
| 664 | +@pytest.mark.parametrize( |
| 665 | + "from_pre,to_pre", itertools.product(["alpha", "beta", "rc"], repeat=2) |
| 666 | +) |
| 667 | +@pytest.mark.usefixtures("tmp_commitizen_project") |
| 668 | +@pytest.mark.freeze_time("2021-06-11") |
| 669 | +def test_changelog_incremental_with_prerelease_version_to_prerelease_version( |
| 670 | + mocker: MockFixture, changelog_path, file_regression, from_pre, to_pre |
| 671 | +): |
| 672 | + with open(changelog_path, "w") as f: |
| 673 | + f.write(KEEP_A_CHANGELOG) |
| 674 | + create_file_and_commit("irrelevant commit") |
| 675 | + git.tag("1.0.0", annotated=True) |
| 676 | + |
| 677 | + create_file_and_commit("feat: add new output") |
| 678 | + create_file_and_commit("fix: output glitch") |
| 679 | + |
| 680 | + testargs = ["cz", "bump", "--changelog", "--prerelease", from_pre, "--yes"] |
| 681 | + mocker.patch.object(sys, "argv", testargs) |
| 682 | + cli.main() |
| 683 | + |
| 684 | + testargs = ["cz", "bump", "--changelog", "--prerelease", to_pre, "--yes"] |
| 685 | + mocker.patch.object(sys, "argv", testargs) |
| 686 | + cli.main() |
| 687 | + |
| 688 | + with open(changelog_path, "r") as f: |
| 689 | + out = f.read() |
| 690 | + |
| 691 | + file_regression.check(out, extension=".md") |
| 692 | + |
| 693 | + |
663 | 694 | @pytest.mark.parametrize("test_input", ["rc", "alpha", "beta"])
|
664 | 695 | @pytest.mark.usefixtures("tmp_commitizen_project")
|
665 | 696 | def test_changelog_release_candidate_version_with_merge_prerelease(
|
|
0 commit comments