def test_print_version_change(mocker, runner, capsys): mock_current_version = mocker.patch( "semantic_release.cli.get_current_version", return_value="1.2.3") mock_evaluate_bump = mocker.patch( "semantic_release.cli.evaluate_version_bump", return_value="minor") print_version() outerr = capsys.readouterr() assert outerr.out == "1.3.0" assert outerr.err == "" mock_current_version.assert_called_once_with() mock_evaluate_bump.assert_called_once_with("1.2.3", None)
def test_print_version_force_major(mocker, runner, capsys): mock_current_version = mocker.patch( "semantic_release.cli.get_current_version", return_value="1.2.3") mock_evaluate_bump = mocker.patch( "semantic_release.cli.evaluate_version_bump", return_value="major") print_version(force_level="major") outerr = capsys.readouterr() assert outerr.out == "2.0.0" assert outerr.err == "" mock_current_version.assert_called_once_with() mock_evaluate_bump.assert_called_once_with("1.2.3", "major")
def test_print_version_no_change(mocker, runner, capsys): mock_new_version = mocker.patch("semantic_release.cli.get_new_version", return_value="1.2.3") mock_evaluate_bump = mocker.patch( "semantic_release.cli.evaluate_version_bump", return_value=None) mock_current_version = mocker.patch( "semantic_release.cli.get_current_version", return_value="1.2.3") mock_current_release_version = mocker.patch( "semantic_release.cli.get_current_release_version", return_value="1.2.3") print_version() outerr = capsys.readouterr() assert outerr.out == "" assert outerr.err == "No release will be made.\n" mock_current_version.assert_called_once() mock_current_release_version.assert_called_once() mock_evaluate_bump.assert_called_once_with("1.2.3", None) mock_new_version.assert_called_once_with("1.2.3", "1.2.3", None, False)