@@ -986,9 +986,12 @@ def test_update_global_changelog(mocker, mock_release_init_request_file):
986986def test_update_version_for_library_success_gapic (mocker ):
987987 m = mock_open ()
988988
989- mock_rglob = mocker .patch (
990- "pathlib.Path.rglob" , return_value = [pathlib .Path ("repo/gapic_version.py" )]
991- )
989+ mock_rglob = mocker .patch ("pathlib.Path.rglob" )
990+ mock_rglob .side_effect = [
991+ [pathlib .Path ("repo/gapic_version.py" )], # 1st call (gapic_version.py)
992+ [], # 2nd call (version.py)
993+ [pathlib .Path ("repo/samples/snippet_metadata.json" )] # 3rd call (snippets)
994+ ]
992995 mock_shutil_copy = mocker .patch ("shutil.copy" )
993996 mock_content = '__version__ = "1.2.2"'
994997 mock_json_metadata = {"clientLibrary" : {"version" : "0.1.0" }}
@@ -1018,7 +1021,11 @@ def test_update_version_for_library_success_proto_only_setup_py(mocker):
10181021 m = mock_open ()
10191022
10201023 mock_rglob = mocker .patch ("pathlib.Path.rglob" )
1021- mock_rglob .side_effect = [[], [pathlib .Path ("repo/setup.py" )]]
1024+ mock_rglob .side_effect = [
1025+ [],
1026+ [pathlib .Path ("repo/setup.py" )],
1027+ [pathlib .Path ("repo/samples/snippet_metadata.json" )]
1028+ ]
10221029 mock_shutil_copy = mocker .patch ("shutil.copy" )
10231030 mock_content = 'version = "1.2.2"'
10241031 mock_json_metadata = {"clientLibrary" : {"version" : "0.1.0" }}
@@ -1049,7 +1056,11 @@ def test_update_version_for_library_success_proto_only_py_project_toml(mocker):
10491056
10501057 mock_path_exists = mocker .patch ("pathlib.Path.exists" )
10511058 mock_rglob = mocker .patch ("pathlib.Path.rglob" )
1052- mock_rglob .side_effect = [[], [pathlib .Path ("repo/pyproject.toml" )]]
1059+ mock_rglob .side_effect = [
1060+ [],
1061+ [pathlib .Path ("repo/pyproject.toml" )],
1062+ [pathlib .Path ("repo/samples/snippet_metadata.json" )]
1063+ ]
10531064 mock_shutil_copy = mocker .patch ("shutil.copy" )
10541065 mock_content = 'version = "1.2.2"'
10551066 mock_json_metadata = {"clientLibrary" : {"version" : "0.1.0" }}
0 commit comments