Skip to content

Commit 6913738

Browse files
authored
PYTHON-2808 Use Invoke-WebRequest instead certifi to workaround FLE test issue (#714)
1 parent 2eb0df8 commit 6913738

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

.evergreen/run-tests.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ if [ -n "$TEST_ENCRYPTION" ]; then
107107

108108
if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
109109
$PYTHON -m pip install -U setuptools
110+
# PYTHON-2808 Ensure this machine has the CA cert for google KMS.
111+
powershell.exe "Invoke-WebRequest -URI https://oauth2.googleapis.com/" > /dev/null || true
110112
fi
111113

112114
if [ -z "$LIBMONGOCRYPT_URL" ]; then
@@ -149,10 +151,6 @@ if [ -n "$TEST_ENCRYPTION" ]; then
149151
. $DRIVERS_TOOLS/.evergreen/csfle/set-temp-creds.sh
150152

151153
# Start the mock KMS servers.
152-
if [ "$OS" = "Windows_NT" ]; then
153-
# Remove after BUILD-13574.
154-
python -m pip install certifi
155-
fi
156154
pushd ${DRIVERS_TOOLS}/.evergreen/csfle
157155
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8000 &
158156
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8001 &

test/test_encryption.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@
5555
from test import (unittest,
5656
client_context,
5757
IntegrationTest,
58-
PyMongoTestCase,
59-
SystemCertsPatcher)
58+
PyMongoTestCase)
6059
from test.utils import (TestCreator,
6160
camel_to_snake_args,
6261
OvertCommandListener,
@@ -66,26 +65,6 @@
6665
wait_until)
6766
from test.utils_spec_runner import SpecRunner
6867

69-
try:
70-
import certifi
71-
HAVE_CERTIFI = True
72-
except ImportError:
73-
HAVE_CERTIFI = False
74-
75-
patcher = None
76-
77-
78-
def setUpModule():
79-
if sys.platform == 'win32' and HAVE_CERTIFI:
80-
# Remove after BUILD-13574.
81-
global patcher
82-
patcher = SystemCertsPatcher(certifi.where())
83-
84-
85-
def tearDownModule():
86-
if patcher:
87-
patcher.disable()
88-
8968

9069
def get_client_opts(client):
9170
return client._MongoClient__options

0 commit comments

Comments
 (0)