From d7362a35e19be170b27bf79a4a970186fcc22fdb Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Wed, 29 Apr 2026 22:22:36 +0000 Subject: [PATCH 1/2] test(bigframes): Add BIGFRAMES_TEST_PROJECT override var for nox config --- packages/bigframes/noxfile.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/bigframes/noxfile.py b/packages/bigframes/noxfile.py index f3b23f7e7d18..8124aad2bfcc 100644 --- a/packages/bigframes/noxfile.py +++ b/packages/bigframes/noxfile.py @@ -28,6 +28,9 @@ import nox import nox.sessions +PROJECT_ID_OVERRIDE = os.getenv("BIGFRAMES_TEST_PROJECT") +ENV_OVERRIDES = {"GOOGLE_CLOUD_PROJECT": PROJECT_ID_OVERRIDE} if PROJECT_ID_OVERRIDE else {} + RUFF_VERSION = "ruff==0.14.14" MYPY_VERSION = "mypy==1.15.0" @@ -371,6 +374,7 @@ def run_system( *pytest_cmd, *session.posargs, test_folder, + env=ENV_OVERRIDES ) @@ -636,6 +640,7 @@ def prerelease(session: nox.sessions.Session, tests_path, extra_pytest_options=( tests_path, *extra_pytest_options, *session.posargs, + env=ENV_OVERRIDES ) @@ -670,7 +675,7 @@ def system_prerelease(session: nox.sessions.Session): @nox.session(python=COLAB_AND_BQ_STUDIO_PYTHON_VERSIONS) def notebook(session: nox.Session): - google_cloud_project = os.getenv("GOOGLE_CLOUD_PROJECT") + google_cloud_project = PROJECT_ID_OVERRIDE or os.getenv("GOOGLE_CLOUD_PROJECT") if not google_cloud_project: session.error( "Set GOOGLE_CLOUD_PROJECT environment variable to run notebook session." @@ -766,6 +771,7 @@ def notebook(session: nox.Session): "python", CURRENT_DIRECTORY / "scripts" / "notebooks_fill_params.py", *notebooks, + env=ENV_OVERRIDES ) processes = [] @@ -780,6 +786,7 @@ def notebook(session: nox.Session): process = multiprocessing.Process( target=session.run, args=args, + kwargs={"env": ENV_OVERRIDES} ) process.start() processes.append(process) @@ -787,7 +794,7 @@ def notebook(session: nox.Session): # process to avoid potential race conditions。 time.sleep(1) else: - session.run(*args) + session.run(*args, env=ENV_OVERRIDES) for notebook, regions in notebooks_reg.items(): for region in regions: @@ -802,6 +809,7 @@ def notebook(session: nox.Session): process = multiprocessing.Process( target=session.run, args=region_args, + kwargs={"env": ENV_OVERRIDES} ) process.start() processes.append(process) @@ -809,7 +817,7 @@ def notebook(session: nox.Session): # process to avoid potential race conditions。 time.sleep(1) else: - session.run(*region_args) + session.run(*region_args, env=ENV_OVERRIDES) for process in processes: process.join() @@ -826,6 +834,7 @@ def notebook(session: nox.Session): "scripts/run_and_publish_benchmark.py", "--notebook", "--publish-benchmarks=notebooks/", + env=ENV_OVERRIDES ) @@ -889,6 +898,7 @@ def benchmark(session: nox.Session): "scripts/run_and_publish_benchmark.py", f"--benchmark-path={benchmark}", f"--iterations={args.iterations}", + env=ENV_OVERRIDES ) finally: session.run( @@ -897,6 +907,7 @@ def benchmark(session: nox.Session): f"--publish-benchmarks={base_path}", f"--iterations={args.iterations}", f"--output-csv={args.output_csv}", + env=ENV_OVERRIDES ) @@ -917,7 +928,7 @@ def release_dry_run(session): @nox.session(python=DEFAULT_PYTHON_VERSION) def cleanup(session): """Clean up stale and/or temporary resources in the test project.""" - google_cloud_project = os.getenv("GOOGLE_CLOUD_PROJECT") + google_cloud_project = PROJECT_ID_OVERRIDE or os.getenv("GOOGLE_CLOUD_PROJECT") cleanup_options = [] if google_cloud_project: cleanup_options.append(f"--project-id={google_cloud_project}") From f12e71c47058b1015b22e5d1236548e92fad68ad Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Thu, 30 Apr 2026 00:43:18 +0000 Subject: [PATCH 2/2] reformat --- packages/bigframes/noxfile.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/packages/bigframes/noxfile.py b/packages/bigframes/noxfile.py index 8124aad2bfcc..788471e0587d 100644 --- a/packages/bigframes/noxfile.py +++ b/packages/bigframes/noxfile.py @@ -29,7 +29,9 @@ import nox.sessions PROJECT_ID_OVERRIDE = os.getenv("BIGFRAMES_TEST_PROJECT") -ENV_OVERRIDES = {"GOOGLE_CLOUD_PROJECT": PROJECT_ID_OVERRIDE} if PROJECT_ID_OVERRIDE else {} +ENV_OVERRIDES = ( + {"GOOGLE_CLOUD_PROJECT": PROJECT_ID_OVERRIDE} if PROJECT_ID_OVERRIDE else {} +) RUFF_VERSION = "ruff==0.14.14" MYPY_VERSION = "mypy==1.15.0" @@ -370,12 +372,7 @@ def run_system( ) pytest_cmd.extend(extra_pytest_options) - session.run( - *pytest_cmd, - *session.posargs, - test_folder, - env=ENV_OVERRIDES - ) + session.run(*pytest_cmd, *session.posargs, test_folder, env=ENV_OVERRIDES) @nox.session(python="3.12") @@ -640,7 +637,7 @@ def prerelease(session: nox.sessions.Session, tests_path, extra_pytest_options=( tests_path, *extra_pytest_options, *session.posargs, - env=ENV_OVERRIDES + env=ENV_OVERRIDES, ) @@ -771,7 +768,7 @@ def notebook(session: nox.Session): "python", CURRENT_DIRECTORY / "scripts" / "notebooks_fill_params.py", *notebooks, - env=ENV_OVERRIDES + env=ENV_OVERRIDES, ) processes = [] @@ -784,9 +781,7 @@ def notebook(session: nox.Session): ) if multi_process_mode: process = multiprocessing.Process( - target=session.run, - args=args, - kwargs={"env": ENV_OVERRIDES} + target=session.run, args=args, kwargs={"env": ENV_OVERRIDES} ) process.start() processes.append(process) @@ -809,7 +804,7 @@ def notebook(session: nox.Session): process = multiprocessing.Process( target=session.run, args=region_args, - kwargs={"env": ENV_OVERRIDES} + kwargs={"env": ENV_OVERRIDES}, ) process.start() processes.append(process) @@ -834,7 +829,7 @@ def notebook(session: nox.Session): "scripts/run_and_publish_benchmark.py", "--notebook", "--publish-benchmarks=notebooks/", - env=ENV_OVERRIDES + env=ENV_OVERRIDES, ) @@ -898,7 +893,7 @@ def benchmark(session: nox.Session): "scripts/run_and_publish_benchmark.py", f"--benchmark-path={benchmark}", f"--iterations={args.iterations}", - env=ENV_OVERRIDES + env=ENV_OVERRIDES, ) finally: session.run( @@ -907,7 +902,7 @@ def benchmark(session: nox.Session): f"--publish-benchmarks={base_path}", f"--iterations={args.iterations}", f"--output-csv={args.output_csv}", - env=ENV_OVERRIDES + env=ENV_OVERRIDES, )