From 95b45a799449ffd8e243df90a4643a66f5a98ef9 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 9 Mar 2026 11:52:12 -0400 Subject: [PATCH] chore: Allow for nox commands to be passed down --- py/noxfile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/py/noxfile.py b/py/noxfile.py index f5435db9..4a5f08da 100644 --- a/py/noxfile.py +++ b/py/noxfile.py @@ -29,6 +29,7 @@ SILENT_INSTALLS = True LATEST = "latest" ERROR_CODES = tuple(range(1, 256)) +INTERNAL_TEST_FLAGS = {"--wheel", "--disable-vcr"} # The minimal set of dependencies we need to run tests. @@ -387,6 +388,7 @@ def _run_tests(session, test_path, ignore_path="", ignore_paths=None, env=None): env = env.copy() if env else {} wheel_flag = "--wheel" in session.posargs common_args = ["--disable-vcr"] if "--disable-vcr" in session.posargs else [] + pytest_posargs = [arg for arg in session.posargs if arg not in INTERNAL_TEST_FLAGS] # Support both ignore_path (for backward compatibility) and ignore_paths paths_to_ignore = [] @@ -408,7 +410,7 @@ def _run_tests(session, test_path, ignore_path="", ignore_paths=None, env=None): ] for path in paths_to_ignore: test_args.append(f"--ignore=src/{path}") - session.run(*test_args, *common_args, env=env) + session.run(*test_args, *common_args, *pytest_posargs, env=env) return # Running the tests from the wheel involves a bit of gymnastics to ensure we don't import @@ -431,7 +433,7 @@ def _run_tests(session, test_path, ignore_path="", ignore_paths=None, env=None): # It proved very helpful because it's very easy # to accidentally import local modules from the source directory. env["BRAINTRUST_TESTING_WHEEL"] = "1" - session.run(pytest_path, abs_test_path, *ignore_args, *common_args, env=env) + session.run(pytest_path, abs_test_path, *ignore_args, *common_args, *pytest_posargs, env=env) # And a final note ... if it's not clear from above, we include test files in our wheel, which # is perhaps not ideal?