test(langchain,partners): disable pytest-benchmark under xdist to silence PytestBenchmarkWarning (#37901)

Test targets run with `-n auto`, which makes `pytest-benchmark` (present
via `langchain-tests`) auto-disable itself and emit a
`PytestBenchmarkWarning` once per xdist worker. Passing
`--benchmark-disable` turns the plugin off explicitly so the warning
never fires, matching what `core` and `langchain_v1` already do.

## Changes
- Add `--benchmark-disable` to the `-n auto` test targets across
`langchain` (unit) and 14 partner packages' integration targets:
`anthropic`, `chroma`, `deepseek`, `exa`, `fireworks`, `groq`,
`huggingface`, `mistralai`, `nomic`, `ollama`, `openai`, `openrouter`,
`qdrant`, `xai`.
- Deliberately excluded `text-splitters` and `model-profiles`: their
`test` group doesn't install `pytest-benchmark`, so the flag would fail
with `unrecognized arguments`. Verified by importing the plugin under
each package's actual dependency group before editing.
This commit is contained in:
Mason Daugherty
2026-06-04 13:25:26 -04:00
committed by GitHub
parent 34af59c1a6
commit 3b999176c8
15 changed files with 15 additions and 15 deletions

View File

@@ -23,7 +23,7 @@ coverage:
$(TEST_FILE) $(TEST_FILE)
test tests: test tests:
uv run --group test pytest -n auto $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE) uv run --group test pytest -n auto --benchmark-disable $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE)
extended_tests: extended_tests:
uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket --only-extended tests/unit_tests uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket --only-extended tests/unit_tests

View File

@@ -15,7 +15,7 @@ test tests:
uv run --group test pytest -vvv $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE) uv run --group test pytest -vvv $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE)
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto --timeout 30 --retries 3 --retry-delay 1 $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable --timeout 30 --retries 3 --retry-delay 1 $(TEST_FILE)
test_watch: test_watch:
uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE) uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE)

View File

@@ -15,7 +15,7 @@ test tests:
uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE) uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE)
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable $(TEST_FILE)
test_watch: test_watch:
uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE) uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE)

View File

@@ -21,7 +21,7 @@ test_watch:
# integration tests are run without the --disable-socket flag to allow network calls # integration tests are run without the --disable-socket flag to allow network calls
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto --timeout=30 $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable --timeout=30 $(TEST_FILE)
###################### ######################
# LINTING AND FORMATTING # LINTING AND FORMATTING

View File

@@ -16,7 +16,7 @@ test:
uv run --group test --group test_integration pytest $(PYTEST_EXTRA) $(TEST_FILE) uv run --group test --group test_integration pytest $(PYTEST_EXTRA) $(TEST_FILE)
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto $(PYTEST_EXTRA) $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable $(PYTEST_EXTRA) $(TEST_FILE)
tests: tests:
uv run --group test pytest $(PYTEST_EXTRA) $(TEST_FILE) uv run --group test pytest $(PYTEST_EXTRA) $(TEST_FILE)

View File

@@ -15,7 +15,7 @@ test tests:
uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE) uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE)
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto --retries 3 --retry-delay 2 $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable --retries 3 --retry-delay 2 $(TEST_FILE)
test_watch: test_watch:
uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE) uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE)

View File

@@ -16,7 +16,7 @@ test tests:
uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE) uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE)
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto --retries 3 --retry-delay 1 $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable --retries 3 --retry-delay 1 $(TEST_FILE)
test_watch: test_watch:
uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE) uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE)

View File

@@ -16,7 +16,7 @@ test tests:
uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE) uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE)
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable $(TEST_FILE)
test_watch: test_watch:
uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE) uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE)

View File

@@ -21,7 +21,7 @@ test_watch:
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto --retries 3 --retry-delay 2 $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable --retries 3 --retry-delay 2 $(TEST_FILE)
###################### ######################

View File

@@ -16,7 +16,7 @@ test:
uv run --group test --group test_integration pytest $(PYTEST_EXTRA) $(TEST_FILE) uv run --group test --group test_integration pytest $(PYTEST_EXTRA) $(TEST_FILE)
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto $(PYTEST_EXTRA) $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable $(PYTEST_EXTRA) $(TEST_FILE)
tests: tests:
uv run --group test pytest $(PYTEST_EXTRA) $(TEST_FILE) uv run --group test pytest $(PYTEST_EXTRA) $(TEST_FILE)

View File

@@ -27,7 +27,7 @@ test_watch:
# integration tests are run without the --disable-socket flag to allow network calls # integration tests are run without the --disable-socket flag to allow network calls
integration_test: integration_test:
OLLAMA_TEST_MODEL=$(OLLAMA_TEST_MODEL) OLLAMA_REASONING_TEST_MODEL=$(OLLAMA_REASONING_TEST_MODEL) uv run --group test --group test_integration pytest -v --tb=short -n auto $(TEST_FILE) OLLAMA_TEST_MODEL=$(OLLAMA_TEST_MODEL) OLLAMA_REASONING_TEST_MODEL=$(OLLAMA_REASONING_TEST_MODEL) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable $(TEST_FILE)
# CI integration tests - disabled until ollama service is configured in CI # CI integration tests - disabled until ollama service is configured in CI

View File

@@ -25,7 +25,7 @@ test tests:
TIKTOKEN_CACHE_DIR=tiktoken_cache uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE) TIKTOKEN_CACHE_DIR=tiktoken_cache uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE)
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable $(TEST_FILE)
# Run VCR cassette-backed integration tests in playback-only mode (no API keys needed). # Run VCR cassette-backed integration tests in playback-only mode (no API keys needed).
# Catches stale cassettes caused by test input changes without re-recording. # Catches stale cassettes caused by test input changes without re-recording.

View File

@@ -21,7 +21,7 @@ test_watch:
# integration tests are run without the --disable-socket flag to allow network calls # integration tests are run without the --disable-socket flag to allow network calls
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto --timeout=120 $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable --timeout=120 $(TEST_FILE)
###################### ######################
# LINTING AND FORMATTING # LINTING AND FORMATTING

View File

@@ -16,7 +16,7 @@ test tests:
uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE) uv run --group test pytest $(PYTEST_EXTRA) --disable-socket --allow-unix-socket $(TEST_FILE)
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable $(TEST_FILE)
test_watch: test_watch:
uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE) uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE)

View File

@@ -19,7 +19,7 @@ test_watch:
uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE) uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE)
integration_test integration_tests: integration_test integration_tests:
uv run --group test --group test_integration pytest -v --tb=short -n auto $(TEST_FILE) uv run --group test --group test_integration pytest -v --tb=short -n auto --benchmark-disable $(TEST_FILE)
###################### ######################
# LINTING AND FORMATTING # LINTING AND FORMATTING