fix(openai): Avoid consuming iterables passed to the Embeddings API #5491
1 issue
find-bugs: Found 1 issue (1 medium)
Medium
Iterator created at test collection time will be exhausted before test runs - `tests/integrations/openai/test_openai.py:1144-1145`
The test uses iter([...]) directly in pytest.param(), which creates the iterator at module load/collection time, not at test execution time. In pytest, parameters are evaluated once during collection. If pytest introspects the parameters (e.g., for --collect-only, verbose output, or test reporting), or if tests are re-run, the iterator may be partially or fully consumed before the actual test executes. This makes the test unreliable and may cause false positives/negatives.
Duration: 2m 45s · Tokens: 921.7k in / 10.0k out · Cost: $1.37 (+extraction: $0.00)
Annotations
Check warning on line 1145 in tests/integrations/openai/test_openai.py
github-actions / warden: find-bugs
Iterator created at test collection time will be exhausted before test runs
The test uses `iter([...])` directly in `pytest.param()`, which creates the iterator at module load/collection time, not at test execution time. In pytest, parameters are evaluated once during collection. If pytest introspects the parameters (e.g., for --collect-only, verbose output, or test reporting), or if tests are re-run, the iterator may be partially or fully consumed before the actual test executes. This makes the test unreliable and may cause false positives/negatives.