@@ -937,6 +937,8 @@ def test_bump_invalid_manual_version_raises_exception(mocker, manual_version):
937937 "0.1.1" ,
938938 "0.2.0" ,
939939 "1.0.0" ,
940+ "1.2" ,
941+ "1" ,
940942 ],
941943)
942944def test_bump_manual_version (mocker , manual_version ):
@@ -966,6 +968,48 @@ def test_bump_manual_version_disallows_major_version_zero(mocker):
966968 assert expected_error_message in str (excinfo .value )
967969
968970
971+ def test_bump_version_with_single_component_in_config (
972+ tmp_commitizen_project_initial , mocker : MockFixture
973+ ):
974+ tmp_commitizen_project = tmp_commitizen_project_initial (version = "1" )
975+
976+ testargs = ["cz" , "bump" , "--yes" ]
977+ mocker .patch .object (sys , "argv" , testargs )
978+
979+ cli .main ()
980+
981+ tag_exists = git .tag_exist ("1.1.0" )
982+ assert tag_exists is True
983+
984+ for version_file in [
985+ tmp_commitizen_project .join ("__version__.py" ),
986+ tmp_commitizen_project .join ("pyproject.toml" ),
987+ ]:
988+ with open (version_file ) as f :
989+ assert "1.1.0" in f .read ()
990+
991+
992+ def test_bump_version_with_two_components_in_config (
993+ tmp_commitizen_project_initial , mocker : MockFixture
994+ ):
995+ tmp_commitizen_project = tmp_commitizen_project_initial (version = "1.2" )
996+
997+ testargs = ["cz" , "bump" , "--yes" ]
998+ mocker .patch .object (sys , "argv" , testargs )
999+
1000+ cli .main ()
1001+
1002+ tag_exists = git .tag_exist ("1.3.0" )
1003+ assert tag_exists is True
1004+
1005+ for version_file in [
1006+ tmp_commitizen_project .join ("__version__.py" ),
1007+ tmp_commitizen_project .join ("pyproject.toml" ),
1008+ ]:
1009+ with open (version_file ) as f :
1010+ assert "1.3.0" in f .read ()
1011+
1012+
9691013@pytest .mark .parametrize ("commit_msg" , ("feat: new file" , "feat(user): new file" ))
9701014def test_bump_with_pre_bump_hooks (
9711015 commit_msg , mocker : MockFixture , tmp_commitizen_project
0 commit comments