Skip to content

Commit af34b9f

Browse files
committed
clean up helpers
1 parent 9556f8c commit af34b9f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

test/asynchronous/helpers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import unittest
3131
import warnings
3232
from inspect import iscoroutinefunction
33+
from pathlib import Path
3334

3435
from pymongo._asyncio_task import create_task
3536

@@ -69,7 +70,11 @@
6970
db_user = os.environ.get("DB_USER", "user")
7071
db_pwd = os.environ.get("DB_PASSWORD", "password")
7172

72-
CERT_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "certificates")
73+
HERE = Path(__file__).absolute()
74+
if _IS_SYNC:
75+
CERT_PATH = str(HERE.parent / "certificates")
76+
else:
77+
CERT_PATH = str(HERE.parent.parent / "certificates")
7378
CLIENT_PEM = os.environ.get("CLIENT_PEM", os.path.join(CERT_PATH, "client.pem"))
7479
CA_PEM = os.environ.get("CA_PEM", os.path.join(CERT_PATH, "ca.pem"))
7580

test/helpers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import unittest
3131
import warnings
3232
from inspect import iscoroutinefunction
33+
from pathlib import Path
3334

3435
from pymongo._asyncio_task import create_task
3536

@@ -69,7 +70,11 @@
6970
db_user = os.environ.get("DB_USER", "user")
7071
db_pwd = os.environ.get("DB_PASSWORD", "password")
7172

72-
CERT_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "certificates")
73+
HERE = Path(__file__).absolute()
74+
if _IS_SYNC:
75+
CERT_PATH = str(HERE.parent / "certificates")
76+
else:
77+
CERT_PATH = str(HERE.parent.parent / "certificates")
7378
CLIENT_PEM = os.environ.get("CLIENT_PEM", os.path.join(CERT_PATH, "client.pem"))
7479
CA_PEM = os.environ.get("CA_PEM", os.path.join(CERT_PATH, "ca.pem"))
7580

0 commit comments

Comments
 (0)