Skip to content

Commit 8f03d44

Browse files
AbhiPrasadviadezo1er
authored andcommitted
chore: Allow for nox commands to be passed down (#56)
1 parent 4e65eb9 commit 8f03d44

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

py/noxfile.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
SILENT_INSTALLS = True
3030
LATEST = "latest"
3131
ERROR_CODES = tuple(range(1, 256))
32+
INTERNAL_TEST_FLAGS = {"--wheel", "--disable-vcr"}
3233

3334

3435
# 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):
387388
env = env.copy() if env else {}
388389
wheel_flag = "--wheel" in session.posargs
389390
common_args = ["--disable-vcr"] if "--disable-vcr" in session.posargs else []
391+
pytest_posargs = [arg for arg in session.posargs if arg not in INTERNAL_TEST_FLAGS]
390392

391393
# Support both ignore_path (for backward compatibility) and ignore_paths
392394
paths_to_ignore = []
@@ -408,7 +410,7 @@ def _run_tests(session, test_path, ignore_path="", ignore_paths=None, env=None):
408410
]
409411
for path in paths_to_ignore:
410412
test_args.append(f"--ignore=src/{path}")
411-
session.run(*test_args, *common_args, env=env)
413+
session.run(*test_args, *common_args, *pytest_posargs, env=env)
412414
return
413415

414416
# 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):
431433
# It proved very helpful because it's very easy
432434
# to accidentally import local modules from the source directory.
433435
env["BRAINTRUST_TESTING_WHEEL"] = "1"
434-
session.run(pytest_path, abs_test_path, *ignore_args, *common_args, env=env)
436+
session.run(pytest_path, abs_test_path, *ignore_args, *common_args, *pytest_posargs, env=env)
435437

436438
# And a final note ... if it's not clear from above, we include test files in our wheel, which
437439
# is perhaps not ideal?

0 commit comments

Comments
 (0)