Skip to content

Commit 0396971

Browse files
committed
PYTHON-4558 Fix coverage and XML results for async tests
1 parent 90d0eb6 commit 0396971

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

.evergreen/run-tests.sh

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ set -o xtrace
3030

3131
AUTH=${AUTH:-noauth}
3232
SSL=${SSL:-nossl}
33+
TEST_SUITES="test/ test/asynchronous/"
3334
TEST_ARGS="${*:1}"
3435

3536
export PIP_QUIET=1 # Quiet by default
@@ -95,7 +96,7 @@ if [ -n "$TEST_LOADBALANCER" ]; then
9596
export LOAD_BALANCER=1
9697
export SINGLE_MONGOS_LB_URI="${SINGLE_MONGOS_LB_URI:-mongodb://127.0.0.1:8000/?loadBalanced=true}"
9798
export MULTI_MONGOS_LB_URI="${MULTI_MONGOS_LB_URI:-mongodb://127.0.0.1:8001/?loadBalanced=true}"
98-
export TEST_ARGS="test/test_load_balancer.py"
99+
export TEST_SUITES="test/test_load_balancer.py"
99100
fi
100101

101102
if [ "$SSL" != "nossl" ]; then
@@ -171,9 +172,7 @@ if [ -n "$TEST_ENCRYPTION" ]; then
171172
export PATH=$CRYPT_SHARED_DIR:$PATH
172173
fi
173174
# Only run the encryption tests.
174-
if [ -z "$TEST_ARGS" ]; then
175-
TEST_ARGS="test/test_encryption.py"
176-
fi
175+
TEST_SUITES="test/test_encryption.py"
177176
fi
178177

179178
if [ -n "$TEST_FLE_AZURE_AUTO" ] || [ -n "$TEST_FLE_GCP_AUTO" ]; then
@@ -187,9 +186,7 @@ if [ -n "$TEST_FLE_AZURE_AUTO" ] || [ -n "$TEST_FLE_GCP_AUTO" ]; then
187186
exit 1
188187
fi
189188

190-
if [ -z "$TEST_ARGS" ]; then
191-
TEST_ARGS="test/test_on_demand_csfle.py"
192-
fi
189+
TEST_SUITES="test/test_on_demand_csfle.py"
193190
fi
194191

195192
if [ -n "$TEST_INDEX_MANAGEMENT" ]; then
@@ -198,36 +195,36 @@ if [ -n "$TEST_INDEX_MANAGEMENT" ]; then
198195
set +x
199196
export DB_PASSWORD="${DRIVERS_ATLAS_LAMBDA_PASSWORD}"
200197
set -x
201-
TEST_ARGS="test/test_index_management.py"
198+
TEST_SUITES="test/test_index_management.py"
202199
fi
203200

204201
if [ -n "$TEST_DATA_LAKE" ] && [ -z "$TEST_ARGS" ]; then
205-
TEST_ARGS="test/test_data_lake.py"
202+
TEST_SUITES="test/test_data_lake.py"
206203
fi
207204

208205
if [ -n "$TEST_ATLAS" ]; then
209-
TEST_ARGS="test/atlas/test_connection.py"
206+
TEST_SUITES="test/atlas/test_connection.py"
210207
fi
211208

212209
if [ -n "$TEST_OCSP" ]; then
213210
python -m pip install ".[ocsp]"
214-
TEST_ARGS="test/ocsp/test_ocsp.py"
211+
TEST_SUITES="test/ocsp/test_ocsp.py"
215212
fi
216213

217214
if [ -n "$TEST_AUTH_AWS" ]; then
218215
python -m pip install ".[aws]"
219-
TEST_ARGS="test/auth_aws/test_auth_aws.py"
216+
TEST_SUITES="test/auth_aws/test_auth_aws.py"
220217
fi
221218

222219
if [ -n "$TEST_AUTH_OIDC" ]; then
223220
python -m pip install ".[aws]"
224-
TEST_ARGS="test/auth_oidc/test_auth_oidc.py $TEST_ARGS"
221+
TEST_SUITES="test/auth_oidc/test_auth_oidc.py $TEST_ARGS"
225222
fi
226223

227224
if [ -n "$PERF_TEST" ]; then
228225
python -m pip install simplejson
229226
start_time=$(date +%s)
230-
TEST_ARGS="test/performance/perf_test.py"
227+
TEST_SUITES="test/performance/perf_test.py"
231228
fi
232229

233230
echo "Running $AUTH tests over $SSL with python $(which python)"
@@ -257,8 +254,7 @@ PIP_QUIET=0 python -m pip list
257254
if [ -z "$GREEN_FRAMEWORK" ]; then
258255
# Use --capture=tee-sys so pytest prints test output inline:
259256
# https://docs.pytest.org/en/stable/how-to/capture-stdout-stderr.html
260-
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 $TEST_ARGS
261-
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 test/asynchronous/ $TEST_ARGS
257+
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 $TEST_SUITES $TEST_ARGS
262258
else
263259
python green_framework_test.py $GREEN_FRAMEWORK -v $TEST_ARGS
264260
fi

.github/workflows/test-python.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,11 @@ jobs:
205205
python-version: '3.8'
206206
- name: Start MongoDB
207207
uses: supercharge/mongodb-github-action@1.10.0
208-
- name: Run Test
208+
- name: Run connect test from sdist
209209
shell: bash
210210
run: |
211211
cd sdist/test
212212
ls
213213
which python
214214
pip install -e ".[test]"
215-
pytest -v
216-
pytest -v test/asynchronous/
215+
PYMONGO_MUST_CONNECT=1 pytest -v test/test_client_context.py

0 commit comments

Comments
 (0)