Skip to content

Commit faccd69

Browse files
committed
address review feedback
1 parent fe18bf6 commit faccd69

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

.generator/cli.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,9 @@ def _read_bazel_build_py_rule(api_path: str, source: str) -> Dict:
285285
286286
Returns:
287287
Dict: A dictionary containing the parsed attributes of the `_py_gapic` rule.
288-
289-
Raises:
290-
ValueError: If the BUILD.bazel file cannot be read or a '_py_gapic' rule is not found.
291288
"""
292289
build_file_path = f"{source}/{api_path}/BUILD.bazel"
293-
try:
294-
content = _read_text_file(build_file_path)
295-
except FileNotFoundError:
296-
raise ValueError(f"BUILD.bazel file not found at {build_file_path}")
290+
content = _read_text_file(build_file_path)
297291

298292
result = parse_googleapis_content.parse_content(content)
299293
py_gapic_entries = [key for key in result.keys() if key.endswith("_py_gapic")]

.generator/test_cli.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,6 @@ def test_read_bazel_build_py_rule_success(mocker, mock_build_bazel_file):
309309
assert py_gapic_config["opt_args"] == ["python-gapic-namespace=google.cloud"]
310310

311311

312-
def test_read_bazel_build_py_rule_not_found(mocker):
313-
"""Tests failure when the BUILD.bazel file is missing."""
314-
mocker.patch("cli._read_text_file", side_effect=FileNotFoundError)
315-
with pytest.raises(ValueError, match="BUILD.bazel file not found"):
316-
_read_bazel_build_py_rule("non/existent/v1", "source")
317-
318-
319312
def test_get_api_generator_options_all_options():
320313
"""Tests option extraction when all relevant fields are present."""
321314
api_path = "google/cloud/language/v1"

0 commit comments

Comments
 (0)