Skip to content

Commit 044d92c

Browse files
authored
PYTHON-4706 Allow running pytest directly without hatch (#1824)
1 parent 29bbf77 commit 044d92c

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

.evergreen/config.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ functions:
410410
SSL=${SSL} \
411411
TEST_DATA_LAKE=${TEST_DATA_LAKE} \
412412
MONGODB_API_VERSION=${MONGODB_API_VERSION} \
413+
SKIP_HATCH=${SKIP_HATCH} \
413414
bash ${PROJECT_DIRECTORY}/.evergreen/hatch.sh test:test-eg
414415
415416
"run enterprise auth tests":
@@ -561,7 +562,9 @@ functions:
561562
working_dir: "src"
562563
script: |
563564
. .evergreen/scripts/env.sh
564-
. .evergreen/hatch.sh encryption:teardown
565+
if [ -f $DRIVERS_TOOLS/.evergreen/csfle/secrets-export.sh ]; then
566+
. .evergreen/hatch.sh encryption:teardown
567+
fi
565568
rm -rf ${DRIVERS_TOOLS} || true
566569
rm -f ./secrets-export.sh || true
567570
@@ -2083,10 +2086,14 @@ axes:
20832086
display_name: "RHEL 8.3 (zSeries)"
20842087
run_on: rhel83-zseries-small
20852088
batchtime: 10080 # 7 days
2089+
variables:
2090+
SKIP_HATCH: true
20862091
- id: rhel81-power8
20872092
display_name: "RHEL 8.1 (POWER8)"
20882093
run_on: rhel81-power8-small
20892094
batchtime: 10080 # 7 days
2095+
variables:
2096+
SKIP_HATCH: true
20902097
- id: rhel82-arm64
20912098
display_name: "RHEL 8.2 (ARM64)"
20922099
run_on: rhel82-arm64-small

.evergreen/hatch.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@ if [ -z "$PYTHON_BINARY" ]; then
88
PYTHON_BINARY=$(find_python3)
99
fi
1010

11-
if $PYTHON_BINARY -m hatch --version; then
11+
# Check if we should skip hatch and run the tests directly.
12+
if [ -n "$SKIP_HATCH" ]; then
13+
ENV_NAME=testenv-$RANDOM
14+
createvirtualenv "$PYTHON_BINARY" $ENV_NAME
15+
# shellcheck disable=SC2064
16+
trap "deactivate; rm -rf $ENV_NAME" EXIT HUP
17+
python -m pip install -e ".[test]"
18+
run_hatch() {
19+
bash ./.evergreen/run-tests.sh
20+
}
21+
elif $PYTHON_BINARY -m hatch --version; then
1222
run_hatch() {
1323
$PYTHON_BINARY -m hatch run "$@"
1424
}

0 commit comments

Comments
 (0)