Skip to content

Commit 1560ea3

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

File tree

4 files changed

+6
-29
lines changed

4 files changed

+6
-29
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 &

bson/codec_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def __eq__(self, other):
172172
'unicode_decode_error_handler', 'tzinfo', 'type_registry'))
173173

174174

175-
class CodecOptions(_options_base):
175+
class JSCodecOptions(_options_base):
176176
"""Encapsulates options used encoding and / or decoding BSON.
177177
178178
The `document_class` option is used to define a custom type for use

bson/json_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class JSONOptions(CodecOptions):
229229
- `tz_aware`: If ``True``, MongoDB Extended JSON's *Strict mode* type
230230
`Date` will be decoded to timezone aware instances of
231231
:class:`datetime.datetime`. Otherwise they will be naive. Defaults
232-
to ``True``.
232+
to ``False``.
233233
- `tzinfo`: A :class:`datetime.tzinfo` subclass that specifies the
234234
timezone from which :class:`~datetime.datetime` objects should be
235235
decoded. Defaults to :const:`~bson.tz_util.utc`.
@@ -249,7 +249,7 @@ def __new__(cls, strict_number_long=False,
249249
datetime_representation=DatetimeRepresentation.LEGACY,
250250
strict_uuid=False, json_mode=JSONMode.LEGACY,
251251
*args, **kwargs):
252-
kwargs["tz_aware"] = kwargs.get("tz_aware", True)
252+
kwargs["tz_aware"] = kwargs.get("tz_aware", False)
253253
if kwargs["tz_aware"]:
254254
kwargs["tzinfo"] = kwargs.get("tzinfo", utc)
255255
if datetime_representation not in (DatetimeRepresentation.LEGACY,

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)