|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | import inspect |
| 4 | +import re |
4 | 5 | import sys |
5 | 6 | from unittest.mock import MagicMock, call |
6 | 7 |
|
@@ -597,6 +598,34 @@ def test_bump_with_changelog_to_stdout_dry_run_arg( |
597 | 598 | assert "0.2.0" in out |
598 | 599 |
|
599 | 600 |
|
| 601 | +@pytest.mark.usefixtures("tmp_commitizen_project") |
| 602 | +def test_bump_without_git_to_stdout_arg(mocker: MockFixture, capsys, changelog_path): |
| 603 | + create_file_and_commit("feat(user): this should appear in stdout") |
| 604 | + testargs = ["cz", "bump", "--yes"] |
| 605 | + mocker.patch.object(sys, "argv", testargs) |
| 606 | + cli.main() |
| 607 | + out, _ = capsys.readouterr() |
| 608 | + |
| 609 | + assert ( |
| 610 | + re.search(r"^\[master \w+] bump: version 0.1.0 → 0.2.0", out, re.MULTILINE) |
| 611 | + is not None |
| 612 | + ) |
| 613 | + |
| 614 | + |
| 615 | +@pytest.mark.usefixtures("tmp_commitizen_project") |
| 616 | +def test_bump_with_git_to_stdout_arg(mocker: MockFixture, capsys, changelog_path): |
| 617 | + create_file_and_commit("feat(user): this should appear in stdout") |
| 618 | + testargs = ["cz", "bump", "--yes", "--git-output-to-stderr"] |
| 619 | + mocker.patch.object(sys, "argv", testargs) |
| 620 | + cli.main() |
| 621 | + out, _ = capsys.readouterr() |
| 622 | + |
| 623 | + assert ( |
| 624 | + re.search(r"^\[master \w+] bump: version 0.1.0 → 0.2.0", out, re.MULTILINE) |
| 625 | + is None |
| 626 | + ) |
| 627 | + |
| 628 | + |
600 | 629 | @pytest.mark.parametrize( |
601 | 630 | "version_filepath, version_regex, version_file_content", |
602 | 631 | [ |
|
0 commit comments