Skip to content

Commit 4aae7b2

Browse files
authored
chore(librarian): reduce runtime of librarian generate --build (#14459)
This PR reduces the runtime of `librarian generate --build` by removing tests. These tests still run as presubmits on the librarian PR. I've opened googleapis/librarian#2211 to follow up on improving performance and restoring these tests.
1 parent bc84473 commit 4aae7b2

File tree

2 files changed

+8
-25
lines changed

2 files changed

+8
-25
lines changed

.generator/cli.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,7 @@ def _run_nox_sessions(library_id: str, repo: str):
416416
the config.yaml.
417417
"""
418418
sessions = [
419-
"unit-3.9",
420-
"unit-3.13",
421-
"docs",
422-
"lint",
423-
"lint_setup_py",
424-
"mypy-3.13",
419+
"unit-3.13(protobuf_implementation='upb')",
425420
]
426421
current_session = None
427422
try:

.generator/test_cli.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -411,12 +411,8 @@ def test_generate_api_success(mocker, caplog):
411411

412412
mock_read_bazel_build_py_rule = mocker.patch("cli._read_bazel_build_py_rule")
413413
mock_get_api_generator_options = mocker.patch("cli._get_api_generator_options")
414-
mock_determine_generator_command = mocker.patch(
415-
"cli._determine_generator_command"
416-
)
417-
mock_run_generator_command = mocker.patch(
418-
"cli._run_generator_command"
419-
)
414+
mock_determine_generator_command = mocker.patch("cli._determine_generator_command")
415+
mock_run_generator_command = mocker.patch("cli._run_generator_command")
420416
mock_shutil_copytree = mocker.patch("shutil.copytree")
421417

422418
_generate_api(API_PATH, LIBRARY_ID, SOURCE, OUTPUT)
@@ -508,24 +504,16 @@ def test_run_nox_sessions_success(mocker, mock_generate_request_data_for_nox):
508504
mock_run_individual_session = mocker.patch("cli._run_individual_session")
509505

510506
sessions_to_run = [
511-
"unit-3.9",
512-
"unit-3.13",
513-
"docs",
514-
"lint",
515-
"lint_setup_py",
516-
"mypy-3.13",
507+
"unit-3.13(protobuf_implementation='upb')",
517508
]
518509
_run_nox_sessions("mock-library", "repo")
519510

520511
assert mock_run_individual_session.call_count == len(sessions_to_run)
521512
mock_run_individual_session.assert_has_calls(
522513
[
523-
mocker.call("unit-3.9", "mock-library", "repo"),
524-
mocker.call("unit-3.13", "mock-library", "repo"),
525-
mocker.call("docs", "mock-library", "repo"),
526-
mocker.call("lint", "mock-library", "repo"),
527-
mocker.call("lint_setup_py", "mock-library", "repo"),
528-
mocker.call("mypy-3.13", "mock-library", "repo"),
514+
mocker.call(
515+
"unit-3.13(protobuf_implementation='upb')", "mock-library", "repo"
516+
),
529517
]
530518
)
531519

@@ -558,7 +546,7 @@ def test_run_nox_sessions_individual_session_failure(
558546
mocker.patch("cli._get_library_id", return_value="mock-library")
559547
mock_run_individual_session = mocker.patch(
560548
"cli._run_individual_session",
561-
side_effect=[None, subprocess.CalledProcessError(1, "nox", "session failed")],
549+
side_effect=[subprocess.CalledProcessError(1, "nox", "session failed")],
562550
)
563551

564552
with pytest.raises(ValueError, match="Failed to run the nox session"):

0 commit comments

Comments
 (0)