@@ -422,10 +422,10 @@ def test_bump_files_only(tmp_commitizen_project, util: UtilFixture):
422422
423423 assert git .tag_exist ("0.3.0" ) is False
424424
425- with open (tmp_version_file , encoding = "utf-8" ) as f :
425+ with tmp_version_file . open (encoding = "utf-8" ) as f :
426426 assert "0.3.0" in f .read ()
427427
428- with open (tmp_commitizen_cfg_file , encoding = "utf-8" ) as f :
428+ with tmp_commitizen_cfg_file . open (encoding = "utf-8" ) as f :
429429 assert "0.3.0" in f .read ()
430430
431431
@@ -444,7 +444,7 @@ def test_bump_local_version(tmp_commitizen_project, util: UtilFixture):
444444 util .run_cli ("bump" , "--yes" , "--local-version" )
445445 assert git .tag_exist ("4.5.1+0.2.0" ) is True
446446
447- with open (tmp_version_file , encoding = "utf-8" ) as f :
447+ with tmp_version_file . open (encoding = "utf-8" ) as f :
448448 assert "4.5.1+0.2.0" in f .read ()
449449
450450
@@ -504,7 +504,7 @@ def test_bump_with_changelog_arg(util: UtilFixture, changelog_path):
504504 util .run_cli ("bump" , "--yes" , "--changelog" )
505505 assert git .tag_exist ("0.2.0" ) is True
506506
507- with open (changelog_path , encoding = "utf-8" ) as f :
507+ with changelog_path . open (encoding = "utf-8" ) as f :
508508 out = f .read ()
509509 assert out .startswith ("#" )
510510 assert "0.2.0" in out
@@ -513,13 +513,13 @@ def test_bump_with_changelog_arg(util: UtilFixture, changelog_path):
513513@pytest .mark .usefixtures ("tmp_commitizen_project" )
514514def test_bump_with_changelog_config (util : UtilFixture , changelog_path , config_path ):
515515 util .create_file_and_commit ("feat(user): new file" )
516- with open (config_path , "a" , encoding = "utf-8" ) as fp :
516+ with config_path . open ("a" , encoding = "utf-8" ) as fp :
517517 fp .write ("update_changelog_on_bump = true\n " )
518518
519519 util .run_cli ("bump" , "--yes" )
520520 assert git .tag_exist ("0.2.0" ) is True
521521
522- with open (changelog_path , encoding = "utf-8" ) as f :
522+ with changelog_path . open (encoding = "utf-8" ) as f :
523523 out = f .read ()
524524 assert out .startswith ("#" )
525525 assert "0.2.0" in out
@@ -557,7 +557,7 @@ def test_bump_with_changelog_to_stdout_arg(
557557 assert "this should appear in stdout" in out
558558 assert git .tag_exist ("0.2.0" ) is True
559559
560- with open (changelog_path , encoding = "utf-8" ) as f :
560+ with changelog_path . open (encoding = "utf-8" ) as f :
561561 out = f .read ()
562562 assert out .startswith ("#" )
563563 assert "0.2.0" in out
@@ -794,14 +794,13 @@ def test_bump_version_with_less_components_in_config(
794794 tmp_commitizen_project = tmp_commitizen_project_initial (version = initial_version )
795795 util .run_cli ("bump" , "--yes" )
796796
797- tag_exists = git .tag_exist (expected_version_after_bump )
798- assert tag_exists is True
797+ assert git .tag_exist (expected_version_after_bump ) is True
799798
800799 for version_file in [
801800 tmp_commitizen_project .join ("__version__.py" ),
802801 tmp_commitizen_project .join ("pyproject.toml" ),
803802 ]:
804- with open (version_file ) as f :
803+ with version_file . open () as f :
805804 assert expected_version_after_bump in f .read ()
806805
807806
@@ -914,15 +913,15 @@ def test_bump_command_prerelease_scheme_via_cli(
914913 assert git .tag_exist ("0.2.0-a0" ) is True
915914
916915 for version_file in [tmp_version_file , tmp_commitizen_cfg_file ]:
917- with open (version_file ) as f :
916+ with version_file . open () as f :
918917 assert "0.2.0-a0" in f .read ()
919918
920919 # PRERELEASE BUMP CREATES VERSION WITHOUT PRERELEASE
921920 util .run_cli ("bump" , "--yes" )
922921 assert git .tag_exist ("0.2.0" ) is True
923922
924923 for version_file in [tmp_version_file , tmp_commitizen_cfg_file ]:
925- with open (version_file ) as f :
924+ with version_file . open () as f :
926925 assert "0.2.0" in f .read ()
927926
928927
@@ -939,22 +938,22 @@ def test_bump_command_prerelease_scheme_via_config(
939938 assert git .tag_exist ("0.2.0-a0" ) is True
940939
941940 for version_file in [tmp_version_file , tmp_commitizen_cfg_file ]:
942- with open (version_file ) as f :
941+ with version_file . open () as f :
943942 assert "0.2.0-a0" in f .read ()
944943
945944 util .run_cli ("bump" , "--prerelease" , "alpha" , "--yes" )
946945 assert git .tag_exist ("0.2.0-a1" ) is True
947946
948947 for version_file in [tmp_version_file , tmp_commitizen_cfg_file ]:
949- with open (version_file ) as f :
948+ with version_file . open () as f :
950949 assert "0.2.0-a1" in f .read ()
951950
952951 # PRERELEASE BUMP CREATES VERSION WITHOUT PRERELEASE
953952 util .run_cli ("bump" , "--yes" )
954953 assert git .tag_exist ("0.2.0" ) is True
955954
956955 for version_file in [tmp_version_file , tmp_commitizen_cfg_file ]:
957- with open (version_file ) as f :
956+ with version_file . open () as f :
958957 assert "0.2.0" in f .read ()
959958
960959
@@ -971,22 +970,22 @@ def test_bump_command_prerelease_scheme_check_old_tags(
971970 assert git .tag_exist ("v0.2.0-a0" ) is True
972971
973972 for version_file in [tmp_version_file , tmp_commitizen_cfg_file ]:
974- with open (version_file ) as f :
973+ with version_file . open () as f :
975974 assert "0.2.0-a0" in f .read ()
976975
977976 util .run_cli ("bump" , "--prerelease" , "alpha" )
978977 assert git .tag_exist ("v0.2.0-a1" ) is True
979978
980979 for version_file in [tmp_version_file , tmp_commitizen_cfg_file ]:
981- with open (version_file ) as f :
980+ with version_file . open () as f :
982981 assert "0.2.0-a1" in f .read ()
983982
984983 # PRERELEASE BUMP CREATES VERSION WITHOUT PRERELEASE
985984 util .run_cli ("bump" )
986985 assert git .tag_exist ("v0.2.0" ) is True
987986
988987 for version_file in [tmp_version_file , tmp_commitizen_cfg_file ]:
989- with open (version_file ) as f :
988+ with version_file . open () as f :
990989 assert "0.2.0" in f .read ()
991990
992991
@@ -1229,7 +1228,7 @@ def test_bump_get_next_update_changelog_on_bump(
12291228 util : UtilFixture , capsys : pytest .CaptureFixture , config_path : Path
12301229):
12311230 util .create_file_and_commit ("feat: new file" )
1232- with open (config_path , "a" , encoding = "utf-8" ) as fp :
1231+ with config_path . open ("a" , encoding = "utf-8" ) as fp :
12331232 fp .write ("update_changelog_on_bump = true\n " )
12341233
12351234 with pytest .raises (DryRunExit ):
@@ -1439,12 +1438,12 @@ def test_is_initial_tag(mocker: MockFixture, tmp_commitizen_project, util: UtilF
14391438def test_changelog_config_flag_merge_prerelease (
14401439 mocker : MockFixture ,
14411440 util : UtilFixture ,
1442- changelog_path : str ,
1443- config_path : str ,
1441+ changelog_path : Path ,
1442+ config_path : Path ,
14441443 file_regression : FileRegressionFixture ,
14451444 test_input : str ,
14461445):
1447- with open (config_path , "a" ) as f :
1446+ with config_path . open ("a" ) as f :
14481447 f .write ("changelog_merge_prerelease = true\n " )
14491448 f .write ("update_changelog_on_bump = true\n " )
14501449 f .write ("annotated_tag = true\n " )
@@ -1459,7 +1458,7 @@ def test_changelog_config_flag_merge_prerelease(
14591458
14601459 util .run_cli ("bump" , "--changelog" )
14611460
1462- with open (changelog_path ) as f :
1461+ with changelog_path . open () as f :
14631462 out = f .read ()
14641463
14651464 file_regression .check (out , extension = ".md" )
@@ -1470,12 +1469,12 @@ def test_changelog_config_flag_merge_prerelease(
14701469@pytest .mark .freeze_time ("2025-01-01" )
14711470def test_changelog_config_flag_merge_prerelease_only_prerelease_present (
14721471 util : UtilFixture ,
1473- changelog_path : str ,
1474- config_path : str ,
1472+ changelog_path : Path ,
1473+ config_path : Path ,
14751474 file_regression : FileRegressionFixture ,
14761475 test_input : str ,
14771476):
1478- with open (config_path , "a" ) as f :
1477+ with config_path . open ("a" ) as f :
14791478 f .write ("changelog_merge_prerelease = true\n " )
14801479 f .write ("update_changelog_on_bump = true\n " )
14811480 f .write ("annotated_tag = true\n " )
@@ -1489,7 +1488,7 @@ def test_changelog_config_flag_merge_prerelease_only_prerelease_present(
14891488
14901489 util .run_cli ("bump" , "--changelog" )
14911490
1492- with open (changelog_path ) as f :
1491+ with changelog_path . open () as f :
14931492 out = f .read ()
14941493
14951494 file_regression .check (out , extension = ".md" )
0 commit comments