Skip to content

Commit 9694239

Browse files
committed
run-tests.sh hacking for compatibility
1 parent 26b1178 commit 9694239

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

.evergreen/run-tests.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,20 +268,32 @@ if [ -z "$GREEN_FRAMEWORK" ]; then
268268
PYTEST_ARGS="-v --capture=tee-sys --durations=5 $TEST_ARGS"
269269
if [ -n "$TEST_SUITES" ]; then
270270
# Workaround until unittest -> pytest conversion is complete
271+
if [[ "$TEST_SUITES" == *"default_async"* ]]; then
272+
# shellcheck disable=SC2206
273+
ASYNC_PYTEST_ARGS=("-m asyncio" "--junitxml=xunit-results/TEST-asyncresults.xml" $PYTEST_ARGS)
274+
else
275+
# shellcheck disable=SC2206
276+
ASYNC_PYTEST_ARGS=("-m asyncio and $TEST_SUITES" "--junitxml=xunit-results/TEST-asyncresults.xml" $PYTEST_ARGS)
277+
fi
271278
# shellcheck disable=SC2206
272-
ASYNC_PYTEST_ARGS=("-m asyncio and $TEST_SUITES" "--junitxml=xunit-results/TEST-asyncresults.xml" $PYTEST_ARGS)
273-
PYTEST_ARGS="-m $TEST_SUITES $PYTEST_ARGS"
279+
PYTEST_ARGS=("-m $TEST_SUITES and not asyncio" $PYTEST_ARGS)
274280
fi
275281
# shellcheck disable=SC2048
276-
uv run ${UV_ARGS[*]} pytest $PYTEST_ARGS
282+
uv run ${UV_ARGS[*]} pytest "${PYTEST_ARGS[@]}"
277283

278284
# Workaround until unittest -> pytest conversion is complete
279-
if [ -z "$TEST_SUITES" ]; then
280-
# shellcheck disable=SC2206
281-
ASYNC_PYTEST_ARGS=("-m asyncio" "--junitxml=xunit-results/TEST-asyncresults.xml" $PYTEST_ARGS)
285+
if [ -n "$TEST_SUITES" ]; then
286+
set +o errexit
287+
# shellcheck disable=SC2048
288+
uv run ${UV_ARGS[*]} pytest "${ASYNC_PYTEST_ARGS[@]}" "--collect-only"
289+
collected=$?
290+
set -o errexit
291+
# If we collected at least one async test, run all collected tests
292+
if [ $collected -ne 5 ]; then
293+
# shellcheck disable=SC2048
294+
uv run ${UV_ARGS[*]} pytest "${ASYNC_PYTEST_ARGS[@]}"
295+
fi
282296
fi
283-
# shellcheck disable=SC2048
284-
uv run ${UV_ARGS[*]} pytest "${ASYNC_PYTEST_ARGS[@]}"
285297
else
286298
# shellcheck disable=SC2048
287299
uv run ${UV_ARGS[*]} green_framework_test.py $GREEN_FRAMEWORK -v $TEST_ARGS

0 commit comments

Comments
 (0)