Skip to content

Commit b851024

Browse files
committed
fixups
1 parent b0dc937 commit b851024

File tree

6 files changed

+41
-4
lines changed

6 files changed

+41
-4
lines changed

.evergreen/run-tests.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0})
66
SCRIPT_DIR="$( cd -- "$SCRIPT_DIR" > /dev/null 2>&1 && pwd )"
77
ROOT_DIR="$(dirname $SCRIPT_DIR)"
88

9-
pushd $ROOT_DIR
9+
PREV_DIR=$(pwd)
10+
cd $ROOT_DIR
1011

1112
# Try to source the env file.
1213
if [ -f $SCRIPT_DIR/scripts/env.sh ]; then
@@ -25,7 +26,17 @@ else
2526
exit 1
2627
fi
2728

29+
cleanup_tests() {
30+
# Avoid leaving the lock file in a changed state when we change the resolution type.
31+
if [ -n "TEST_MIN_DEPS" ]; then
32+
git checkout uv.lock || true
33+
fi
34+
cd $PREV_DIR
35+
}
36+
37+
trap "cleanup_tests" SIGINT ERR
38+
2839
# Start the test runner.
2940
uv run ${UV_ARGS} --reinstall .evergreen/scripts/run_tests.py "$@"
3041

31-
popd
42+
cleanup_tests()

CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,6 @@ If you are running one of the `no-responder` tests, omit the `run-server` step.
387387
To run any of the test suites with minimum supported dependencies, pass `--test-min-deps` to
388388
`just setup-tests`.
389389

390-
Note: the lock file will be modified by the test, make sure to revert `uv.lock` before committing.
391-
392390
## Adding a new test suite
393391

394392
- If adding new tests files that should only be run for that test suite, add a pytest marker to the file and add

test/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,19 @@ def require_libmongocrypt_min(self, *ver):
519519
"Libmongocrypt version must be at least %s" % str(other_version),
520520
)
521521

522+
def require_pymongocrypt_min(self, *ver):
523+
other_version = Version(*ver)
524+
if not _HAVE_PYMONGOCRYPT:
525+
version = Version.from_string("0.0.0")
526+
else:
527+
from pymongocrypt import __version__ as pymongocrypt_version
528+
529+
version = Version.from_string(pymongocrypt_version)
530+
return self._require(
531+
lambda: version >= other_version,
532+
"PyMongoCrypt version must be at least %s" % str(other_version),
533+
)
534+
522535
def require_auth(self, func):
523536
"""Run a test only if the server is running with auth enabled."""
524537
return self._require(

test/asynchronous/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,19 @@ def require_libmongocrypt_min(self, *ver):
519519
"Libmongocrypt version must be at least %s" % str(other_version),
520520
)
521521

522+
def require_pymongocrypt_min(self, *ver):
523+
other_version = Version(*ver)
524+
if not _HAVE_PYMONGOCRYPT:
525+
version = Version.from_string("0.0.0")
526+
else:
527+
from pymongocrypt import __version__ as pymongocrypt_version
528+
529+
version = Version.from_string(pymongocrypt_version)
530+
return self._require(
531+
lambda: version >= other_version,
532+
"PyMongoCrypt version must be at least %s" % str(other_version),
533+
)
534+
522535
def require_auth(self, func):
523536
"""Run a test only if the server is running with auth enabled."""
524537
return self._require(

test/asynchronous/test_encryption.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3448,6 +3448,7 @@ class TestExplicitTextEncryptionProse(AsyncEncryptionIntegrationTest):
34483448
@async_client_context.require_no_standalone
34493449
@async_client_context.require_version_min(8, 2, -1)
34503450
@async_client_context.require_libmongocrypt_min(1, 15, 1)
3451+
@async_client_context.require_pymongocrypt_min(1, 16, 0)
34513452
async def asyncSetUp(self):
34523453
await super().asyncSetUp()
34533454
# Load the file key1-document.json as key1Document.

test/test_encryption.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3430,6 +3430,7 @@ class TestExplicitTextEncryptionProse(EncryptionIntegrationTest):
34303430
@client_context.require_no_standalone
34313431
@client_context.require_version_min(8, 2, -1)
34323432
@client_context.require_libmongocrypt_min(1, 15, 1)
3433+
@client_context.require_pymongocrypt_min(1, 16, 0)
34333434
def setUp(self):
34343435
super().setUp()
34353436
# Load the file key1-document.json as key1Document.

0 commit comments

Comments
 (0)