|
| 1 | +import itertools |
1 | 2 | import sys
|
2 | 3 | from datetime import datetime
|
3 | 4 |
|
@@ -549,6 +550,36 @@ def test_changelog_incremental_with_release_candidate_version(
|
549 | 550 | file_regression.check(out, extension=".md")
|
550 | 551 |
|
551 | 552 |
|
| 553 | +@pytest.mark.parametrize( |
| 554 | + "from_pre,to_pre", itertools.product(["alpha", "beta", "rc"], repeat=2) |
| 555 | +) |
| 556 | +@pytest.mark.usefixtures("tmp_commitizen_project") |
| 557 | +@pytest.mark.freeze_time("2021-06-11") |
| 558 | +def test_changelog_incremental_with_prerelease_version_to_prerelease_version( |
| 559 | + mocker: MockFixture, changelog_path, file_regression, from_pre, to_pre |
| 560 | +): |
| 561 | + with open(changelog_path, "w") as f: |
| 562 | + f.write(KEEP_A_CHANGELOG) |
| 563 | + create_file_and_commit("irrelevant commit") |
| 564 | + git.tag("1.0.0", annotated=True) |
| 565 | + |
| 566 | + create_file_and_commit("feat: add new output") |
| 567 | + create_file_and_commit("fix: output glitch") |
| 568 | + |
| 569 | + testargs = ["cz", "bump", "--changelog", "--prerelease", from_pre, "--yes"] |
| 570 | + mocker.patch.object(sys, "argv", testargs) |
| 571 | + cli.main() |
| 572 | + |
| 573 | + testargs = ["cz", "bump", "--changelog", "--prerelease", to_pre, "--yes"] |
| 574 | + mocker.patch.object(sys, "argv", testargs) |
| 575 | + cli.main() |
| 576 | + |
| 577 | + with open(changelog_path, "r") as f: |
| 578 | + out = f.read() |
| 579 | + |
| 580 | + file_regression.check(out, extension=".md") |
| 581 | + |
| 582 | + |
552 | 583 | @pytest.mark.usefixtures("tmp_commitizen_project")
|
553 | 584 | def test_changelog_with_filename_as_empty_string(
|
554 | 585 | mocker: MockFixture, changelog_path, config_path
|
|
0 commit comments