@@ -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,37 @@ def test_bump_manual_version_disallows_major_version_zero(mocker):
966968 assert expected_error_message in str (excinfo .value )
967969
968970
971+ @pytest .mark .parametrize (
972+ "initial_version, expected_version_after_bump" ,
973+ [
974+ ("1" , "1.1.0" ),
975+ ("1.2" , "1.3.0" ),
976+ ],
977+ )
978+ def test_bump_version_with_less_components_in_config (
979+ tmp_commitizen_project_initial ,
980+ mocker : MockFixture ,
981+ initial_version ,
982+ expected_version_after_bump ,
983+ ):
984+ tmp_commitizen_project = tmp_commitizen_project_initial (version = initial_version )
985+
986+ testargs = ["cz" , "bump" , "--yes" ]
987+ mocker .patch .object (sys , "argv" , testargs )
988+
989+ cli .main ()
990+
991+ tag_exists = git .tag_exist (expected_version_after_bump )
992+ assert tag_exists is True
993+
994+ for version_file in [
995+ tmp_commitizen_project .join ("__version__.py" ),
996+ tmp_commitizen_project .join ("pyproject.toml" ),
997+ ]:
998+ with open (version_file ) as f :
999+ assert expected_version_after_bump in f .read ()
1000+
1001+
9691002@pytest .mark .parametrize ("commit_msg" , ("feat: new file" , "feat(user): new file" ))
9701003def test_bump_with_pre_bump_hooks (
9711004 commit_msg , mocker : MockFixture , tmp_commitizen_project
0 commit comments