@@ -988,9 +988,12 @@ def test_update_global_changelog(mocker, mock_release_init_request_file):
988988def test_update_version_for_library_success_gapic (mocker ):
989989 m = mock_open ()
990990
991- mock_rglob = mocker .patch (
992- "pathlib.Path.rglob" , return_value = [pathlib .Path ("repo/gapic_version.py" )]
993- )
991+ mock_rglob = mocker .patch ("pathlib.Path.rglob" )
992+ mock_rglob .side_effect = [
993+ [pathlib .Path ("repo/gapic_version.py" )], # 1st call (gapic_version.py)
994+ [], # 2nd call (version.py)
995+ [pathlib .Path ("repo/samples/snippet_metadata.json" )] # 3rd call (snippets)
996+ ]
994997 mock_shutil_copy = mocker .patch ("shutil.copy" )
995998 mock_content = '__version__ = "1.2.2"'
996999 mock_json_metadata = {"clientLibrary" : {"version" : "0.1.0" }}
@@ -1020,7 +1023,11 @@ def test_update_version_for_library_success_proto_only_setup_py(mocker):
10201023 m = mock_open ()
10211024
10221025 mock_rglob = mocker .patch ("pathlib.Path.rglob" )
1023- mock_rglob .side_effect = [[], [pathlib .Path ("repo/setup.py" )]]
1026+ mock_rglob .side_effect = [
1027+ [],
1028+ [pathlib .Path ("repo/setup.py" )],
1029+ [pathlib .Path ("repo/samples/snippet_metadata.json" )]
1030+ ]
10241031 mock_shutil_copy = mocker .patch ("shutil.copy" )
10251032 mock_content = 'version = "1.2.2"'
10261033 mock_json_metadata = {"clientLibrary" : {"version" : "0.1.0" }}
@@ -1051,7 +1058,11 @@ def test_update_version_for_library_success_proto_only_py_project_toml(mocker):
10511058
10521059 mock_path_exists = mocker .patch ("pathlib.Path.exists" )
10531060 mock_rglob = mocker .patch ("pathlib.Path.rglob" )
1054- mock_rglob .side_effect = [[], [pathlib .Path ("repo/pyproject.toml" )]]
1061+ mock_rglob .side_effect = [
1062+ [],
1063+ [pathlib .Path ("repo/pyproject.toml" )],
1064+ [pathlib .Path ("repo/samples/snippet_metadata.json" )]
1065+ ]
10551066 mock_shutil_copy = mocker .patch ("shutil.copy" )
10561067 mock_content = 'version = "1.2.2"'
10571068 mock_json_metadata = {"clientLibrary" : {"version" : "0.1.0" }}
0 commit comments