Skip to content

Commit c7423e5

Browse files
jariy17jariy17
andauthored
fix(ci): stop flaky sleep test and compat evaluation errors (#677)
- Stop ragas' background telemetry thread in tests. It calls time.sleep(1) in a loop, and patching time.sleep in a test patches it for every thread, so the mock picked up hundreds of stray calls. - Skip test_third_party_adapters.py in the compat job. It needs OpenAI and Braintrust API keys that the job doesn't have. Co-authored-by: jariy17 <tjariy+jariy17@users.noreply.github.com>
1 parent e9dcd40 commit c7423e5

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

‎.github/workflows/integration-testing-regression.yml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ jobs:
151151
extra-deps: ""
152152
- group: evaluation
153153
path: tests_integ/evaluation
154+
# These tests need OpenAI and Braintrust API keys, which this job
155+
# doesn't have. The secure integ workflow runs them.
156+
extra-args: --ignore=tests_integ/evaluation/test_third_party_adapters.py
154157
timeout: 15
155158
extra-deps: "strands-agents-evals"
156159
- group: services
@@ -247,16 +250,17 @@ jobs:
247250
BASELINE_TAG: ${{ needs.resolve-tag.outputs.tag }}
248251
TEST_GROUP: ${{ matrix.group }}
249252
PYTEST_PATH: ${{ matrix.path }}
253+
PYTEST_EXTRA_ARGS: ${{ matrix.extra-args || '' }}
250254
timeout-minutes: ${{ matrix.timeout }}
251255
working-directory: /tmp/baseline-tests
252-
# PYTEST_PATH comes from the job matrix and holds space-separated pytest
253-
# path args; left unquoted intentionally so it word-splits.
256+
# PYTEST_PATH and PYTEST_EXTRA_ARGS are unquoted on purpose so they
257+
# split into separate pytest args.
254258
run: |
255259
echo "================================================"
256260
echo "Library: bedrock-agentcore (PR branch source)"
257261
echo "Test suite: $BASELINE_TAG tests_integ/$TEST_GROUP"
258262
echo "================================================"
259-
pytest $PYTEST_PATH \
263+
pytest $PYTEST_PATH $PYTEST_EXTRA_ARGS \
260264
-n auto --dist=loadscope \
261265
-s --log-cli-level=INFO
262266

‎tests/conftest.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""Shared pytest configuration."""
2+
3+
import sys
4+
5+
6+
def pytest_runtest_teardown(item):
7+
"""Stop ragas' background telemetry thread once ragas is imported.
8+
9+
The thread calls ``time.sleep(1)`` in a loop. Patching ``time.sleep`` in a
10+
test patches it for every thread, so the ragas thread's calls land on the
11+
mock and break call-count assertions.
12+
"""
13+
analytics = sys.modules.get("ragas._analytics")
14+
if analytics is not None:
15+
analytics._analytics_batcher._running = False

0 commit comments

Comments
 (0)