Skip to content

Commit 5354208

Browse files
committed
address review
1 parent 16d2c11 commit 5354208

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.evergreen/scripts/setup_tests.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
ROOT = HERE.parent.parent
2020
ENV_FILE = HERE / "test-env.sh"
2121
DRIVERS_TOOLS = os.environ.get("DRIVERS_TOOLS", "").replace(os.sep, "/")
22+
PLATFORM = "windows" if os.name == "nt" else sys.platform
2223

2324
logging.basicConfig(level=logging.INFO)
2425
LOGGER = logging.getLogger(__name__)
@@ -98,13 +99,13 @@ def run_command(cmd: str) -> None:
9899

99100
def setup_libmongocrypt():
100101
target = ""
101-
if os.name == "nt":
102+
if PLATFORM == "windows":
102103
# PYTHON-2808 Ensure this machine has the CA cert for google KMS.
103104
if is_set("TEST_FLE_GCP_AUTO"):
104105
run_command('powershell.exe "Invoke-WebRequest -URI https://oauth2.googleapis.com/"')
105106
target = "windows-test"
106107

107-
elif sys.platform == "darwin":
108+
elif PLATFORM == "darwin":
108109
target = "macos"
109110

110111
else:
@@ -149,7 +150,7 @@ def setup_libmongocrypt():
149150
run_command("ls -la libmongocrypt")
150151
run_command("ls -la libmongocrypt/nocrypto")
151152

152-
if os.name == "nt":
153+
if PLATFORM == "windows":
153154
# libmongocrypt's windows dll is not marked executable.
154155
run_command("chmod +x libmongocrypt/nocrypto/bin/mongocrypt.dll")
155156

@@ -218,7 +219,7 @@ def handle_test_env() -> None:
218219
write_env("PYMONGO_DISABLE_TEST_COMMANDS", "1")
219220

220221
if is_set("TEST_ENTERPRISE_AUTH"):
221-
if os.name == "nt":
222+
if PLATFORM == "windows":
222223
LOGGER.info("Setting GSSAPI_PASS")
223224
write_env("GSSAPI_PASS", os.environ["SASL_PASS"])
224225
write_env("GSSAPI_CANONICALIZE", "true")
@@ -283,12 +284,12 @@ def handle_test_env() -> None:
283284

284285
# Use the nocrypto build to avoid dependency issues with older windows/python versions.
285286
BASE = ROOT / "libmongocrypt/nocrypto"
286-
if sys.platform == "linux":
287+
if PLATFORM == "linux":
287288
if (BASE / "lib/libmongocrypt.so").exists():
288289
PYMONGOCRYPT_LIB = BASE / "lib/libmongocrypt.so"
289290
else:
290291
PYMONGOCRYPT_LIB = BASE / "lib64/libmongocrypt.so"
291-
elif sys.platform == "darwin":
292+
elif PLATFORM == "darwin":
292293
PYMONGOCRYPT_LIB = BASE / "lib/libmongocrypt.dylib"
293294
else:
294295
PYMONGOCRYPT_LIB = BASE / "bin/mongocrypt.dll"
@@ -306,7 +307,7 @@ def handle_test_env() -> None:
306307
if is_set("TEST_CRYPT_SHARED"):
307308
CRYPT_SHARED_DIR = Path(os.environ["CRYPT_SHARED_LIB_PATH"]).parent.as_posix()
308309
LOGGER.info("Using crypt_shared_dir %s", CRYPT_SHARED_DIR)
309-
if os.name == "nt":
310+
if PLATFORM == "windows":
310311
write_env("PATH", f"{CRYPT_SHARED_DIR}:$PATH")
311312
else:
312313
write_env(

0 commit comments

Comments
 (0)