PYTHON-4706 Allow running pytest directly without hatch (#1824)

This commit is contained in:
Steven Silvester 2024-09-05 19:34:01 -05:00 committed by GitHub
parent 29bbf77dad
commit 044d92cc14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 2 deletions

View File

@ -410,6 +410,7 @@ functions:
SSL=${SSL} \
TEST_DATA_LAKE=${TEST_DATA_LAKE} \
MONGODB_API_VERSION=${MONGODB_API_VERSION} \
SKIP_HATCH=${SKIP_HATCH} \
bash ${PROJECT_DIRECTORY}/.evergreen/hatch.sh test:test-eg
"run enterprise auth tests":
@ -561,7 +562,9 @@ functions:
working_dir: "src"
script: |
. .evergreen/scripts/env.sh
. .evergreen/hatch.sh encryption:teardown
if [ -f $DRIVERS_TOOLS/.evergreen/csfle/secrets-export.sh ]; then
. .evergreen/hatch.sh encryption:teardown
fi
rm -rf ${DRIVERS_TOOLS} || true
rm -f ./secrets-export.sh || true
@ -2083,10 +2086,14 @@ axes:
display_name: "RHEL 8.3 (zSeries)"
run_on: rhel83-zseries-small
batchtime: 10080 # 7 days
variables:
SKIP_HATCH: true
- id: rhel81-power8
display_name: "RHEL 8.1 (POWER8)"
run_on: rhel81-power8-small
batchtime: 10080 # 7 days
variables:
SKIP_HATCH: true
- id: rhel82-arm64
display_name: "RHEL 8.2 (ARM64)"
run_on: rhel82-arm64-small

View File

@ -8,7 +8,17 @@ if [ -z "$PYTHON_BINARY" ]; then
PYTHON_BINARY=$(find_python3)
fi
if $PYTHON_BINARY -m hatch --version; then
# Check if we should skip hatch and run the tests directly.
if [ -n "$SKIP_HATCH" ]; then
ENV_NAME=testenv-$RANDOM
createvirtualenv "$PYTHON_BINARY" $ENV_NAME
# shellcheck disable=SC2064
trap "deactivate; rm -rf $ENV_NAME" EXIT HUP
python -m pip install -e ".[test]"
run_hatch() {
bash ./.evergreen/run-tests.sh
}
elif $PYTHON_BINARY -m hatch --version; then
run_hatch() {
$PYTHON_BINARY -m hatch run "$@"
}