PYTHON-4558 Fix coverage and XML results for async tests (#1738)
This commit is contained in:
parent
f0e025a127
commit
0d89e1276c
@ -30,6 +30,7 @@ set -o xtrace
|
||||
|
||||
AUTH=${AUTH:-noauth}
|
||||
SSL=${SSL:-nossl}
|
||||
TEST_SUITES="test/ test/asynchronous/"
|
||||
TEST_ARGS="${*:1}"
|
||||
|
||||
export PIP_QUIET=1 # Quiet by default
|
||||
@ -95,7 +96,7 @@ if [ -n "$TEST_LOADBALANCER" ]; then
|
||||
export LOAD_BALANCER=1
|
||||
export SINGLE_MONGOS_LB_URI="${SINGLE_MONGOS_LB_URI:-mongodb://127.0.0.1:8000/?loadBalanced=true}"
|
||||
export MULTI_MONGOS_LB_URI="${MULTI_MONGOS_LB_URI:-mongodb://127.0.0.1:8001/?loadBalanced=true}"
|
||||
export TEST_ARGS="test/test_load_balancer.py"
|
||||
export TEST_SUITES="test/test_load_balancer.py"
|
||||
fi
|
||||
|
||||
if [ "$SSL" != "nossl" ]; then
|
||||
@ -171,9 +172,7 @@ if [ -n "$TEST_ENCRYPTION" ]; then
|
||||
export PATH=$CRYPT_SHARED_DIR:$PATH
|
||||
fi
|
||||
# Only run the encryption tests.
|
||||
if [ -z "$TEST_ARGS" ]; then
|
||||
TEST_ARGS="test/test_encryption.py"
|
||||
fi
|
||||
TEST_SUITES="test/test_encryption.py"
|
||||
fi
|
||||
|
||||
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
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$TEST_ARGS" ]; then
|
||||
TEST_ARGS="test/test_on_demand_csfle.py"
|
||||
fi
|
||||
TEST_SUITES="test/test_on_demand_csfle.py"
|
||||
fi
|
||||
|
||||
if [ -n "$TEST_INDEX_MANAGEMENT" ]; then
|
||||
@ -198,36 +195,36 @@ if [ -n "$TEST_INDEX_MANAGEMENT" ]; then
|
||||
set +x
|
||||
export DB_PASSWORD="${DRIVERS_ATLAS_LAMBDA_PASSWORD}"
|
||||
set -x
|
||||
TEST_ARGS="test/test_index_management.py"
|
||||
TEST_SUITES="test/test_index_management.py"
|
||||
fi
|
||||
|
||||
if [ -n "$TEST_DATA_LAKE" ] && [ -z "$TEST_ARGS" ]; then
|
||||
TEST_ARGS="test/test_data_lake.py"
|
||||
TEST_SUITES="test/test_data_lake.py"
|
||||
fi
|
||||
|
||||
if [ -n "$TEST_ATLAS" ]; then
|
||||
TEST_ARGS="test/atlas/test_connection.py"
|
||||
TEST_SUITES="test/atlas/test_connection.py"
|
||||
fi
|
||||
|
||||
if [ -n "$TEST_OCSP" ]; then
|
||||
python -m pip install ".[ocsp]"
|
||||
TEST_ARGS="test/ocsp/test_ocsp.py"
|
||||
TEST_SUITES="test/ocsp/test_ocsp.py"
|
||||
fi
|
||||
|
||||
if [ -n "$TEST_AUTH_AWS" ]; then
|
||||
python -m pip install ".[aws]"
|
||||
TEST_ARGS="test/auth_aws/test_auth_aws.py"
|
||||
TEST_SUITES="test/auth_aws/test_auth_aws.py"
|
||||
fi
|
||||
|
||||
if [ -n "$TEST_AUTH_OIDC" ]; then
|
||||
python -m pip install ".[aws]"
|
||||
TEST_ARGS="test/auth_oidc/test_auth_oidc.py $TEST_ARGS"
|
||||
TEST_SUITES="test/auth_oidc/test_auth_oidc.py $TEST_ARGS"
|
||||
fi
|
||||
|
||||
if [ -n "$PERF_TEST" ]; then
|
||||
python -m pip install simplejson
|
||||
start_time=$(date +%s)
|
||||
TEST_ARGS="test/performance/perf_test.py"
|
||||
TEST_SUITES="test/performance/perf_test.py"
|
||||
fi
|
||||
|
||||
echo "Running $AUTH tests over $SSL with python $(which python)"
|
||||
@ -257,8 +254,7 @@ PIP_QUIET=0 python -m pip list
|
||||
if [ -z "$GREEN_FRAMEWORK" ]; then
|
||||
# Use --capture=tee-sys so pytest prints test output inline:
|
||||
# https://docs.pytest.org/en/stable/how-to/capture-stdout-stderr.html
|
||||
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 $TEST_ARGS
|
||||
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 test/asynchronous/ $TEST_ARGS
|
||||
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 $TEST_SUITES $TEST_ARGS
|
||||
else
|
||||
python green_framework_test.py $GREEN_FRAMEWORK -v $TEST_ARGS
|
||||
fi
|
||||
|
||||
5
.github/workflows/test-python.yml
vendored
5
.github/workflows/test-python.yml
vendored
@ -205,12 +205,11 @@ jobs:
|
||||
python-version: '3.8'
|
||||
- name: Start MongoDB
|
||||
uses: supercharge/mongodb-github-action@1.10.0
|
||||
- name: Run Test
|
||||
- name: Run connect test from sdist
|
||||
shell: bash
|
||||
run: |
|
||||
cd sdist/test
|
||||
ls
|
||||
which python
|
||||
pip install -e ".[test]"
|
||||
pytest -v
|
||||
pytest -v test/asynchronous/
|
||||
PYMONGO_MUST_CONNECT=1 pytest -v test/test_client_context.py
|
||||
|
||||
Loading…
Reference in New Issue
Block a user