19
19
ROOT = HERE .parent .parent
20
20
ENV_FILE = HERE / "test-env.sh"
21
21
DRIVERS_TOOLS = os .environ .get ("DRIVERS_TOOLS" , "" ).replace (os .sep , "/" )
22
+ PLATFORM = "windows" if os .name == "nt" else sys .platform
22
23
23
24
logging .basicConfig (level = logging .INFO )
24
25
LOGGER = logging .getLogger (__name__ )
@@ -98,13 +99,13 @@ def run_command(cmd: str) -> None:
98
99
99
100
def setup_libmongocrypt ():
100
101
target = ""
101
- if os . name == "nt " :
102
+ if PLATFORM == "windows " :
102
103
# PYTHON-2808 Ensure this machine has the CA cert for google KMS.
103
104
if is_set ("TEST_FLE_GCP_AUTO" ):
104
105
run_command ('powershell.exe "Invoke-WebRequest -URI https://oauth2.googleapis.com/"' )
105
106
target = "windows-test"
106
107
107
- elif sys . platform == "darwin" :
108
+ elif PLATFORM == "darwin" :
108
109
target = "macos"
109
110
110
111
else :
@@ -149,7 +150,7 @@ def setup_libmongocrypt():
149
150
run_command ("ls -la libmongocrypt" )
150
151
run_command ("ls -la libmongocrypt/nocrypto" )
151
152
152
- if os . name == "nt " :
153
+ if PLATFORM == "windows " :
153
154
# libmongocrypt's windows dll is not marked executable.
154
155
run_command ("chmod +x libmongocrypt/nocrypto/bin/mongocrypt.dll" )
155
156
@@ -218,7 +219,7 @@ def handle_test_env() -> None:
218
219
write_env ("PYMONGO_DISABLE_TEST_COMMANDS" , "1" )
219
220
220
221
if is_set ("TEST_ENTERPRISE_AUTH" ):
221
- if os . name == "nt " :
222
+ if PLATFORM == "windows " :
222
223
LOGGER .info ("Setting GSSAPI_PASS" )
223
224
write_env ("GSSAPI_PASS" , os .environ ["SASL_PASS" ])
224
225
write_env ("GSSAPI_CANONICALIZE" , "true" )
@@ -283,12 +284,12 @@ def handle_test_env() -> None:
283
284
284
285
# Use the nocrypto build to avoid dependency issues with older windows/python versions.
285
286
BASE = ROOT / "libmongocrypt/nocrypto"
286
- if sys . platform == "linux" :
287
+ if PLATFORM == "linux" :
287
288
if (BASE / "lib/libmongocrypt.so" ).exists ():
288
289
PYMONGOCRYPT_LIB = BASE / "lib/libmongocrypt.so"
289
290
else :
290
291
PYMONGOCRYPT_LIB = BASE / "lib64/libmongocrypt.so"
291
- elif sys . platform == "darwin" :
292
+ elif PLATFORM == "darwin" :
292
293
PYMONGOCRYPT_LIB = BASE / "lib/libmongocrypt.dylib"
293
294
else :
294
295
PYMONGOCRYPT_LIB = BASE / "bin/mongocrypt.dll"
@@ -306,7 +307,7 @@ def handle_test_env() -> None:
306
307
if is_set ("TEST_CRYPT_SHARED" ):
307
308
CRYPT_SHARED_DIR = Path (os .environ ["CRYPT_SHARED_LIB_PATH" ]).parent .as_posix ()
308
309
LOGGER .info ("Using crypt_shared_dir %s" , CRYPT_SHARED_DIR )
309
- if os . name == "nt " :
310
+ if PLATFORM == "windows " :
310
311
write_env ("PATH" , f"{ CRYPT_SHARED_DIR } :$PATH" )
311
312
else :
312
313
write_env (
0 commit comments