Skip to content

Commit 0cfb39b

Browse files
authored
fix: relative path destination local mode (#47)
1 parent b42c306 commit 0cfb39b

File tree

6 files changed

+10
-17
lines changed

6 files changed

+10
-17
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "sap-cloud-sdk"
3-
version = "0.6.1"
3+
version = "0.6.2"
44
description = "SAP Cloud SDK for Python"
55
readme = "README.md"
66
license = "Apache-2.0"

src/sap_cloud_sdk/destination/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,8 @@
7070

7171

7272
def _mock_file(name: str) -> str:
73-
"""Return the absolute path to a mocks/<name> file relative to the repo root."""
74-
repo_root = os.path.abspath(
75-
os.path.join(os.path.dirname(__file__), "..", "..", "..")
76-
)
77-
return os.path.join(repo_root, "mocks", name)
73+
"""Return the absolute path to a mocks/<name> file relative to the working directory."""
74+
return os.path.join(os.getcwd(), "mocks", name)
7875

7976

8077
def create_client(

src/sap_cloud_sdk/destination/_local_client_base.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ class LocalDevClientBase(ABC, Generic[T]):
4343
"""
4444

4545
def __init__(self) -> None:
46-
# Resolve to repo root and mocks path
47-
repo_root = os.path.abspath(
48-
os.path.join(os.path.dirname(__file__), "..", "..", "..")
49-
)
50-
self._file_path = os.path.join(repo_root, "mocks", self.file_name)
46+
self._file_path = os.path.join(os.getcwd(), "mocks", self.file_name)
5147
self._lock = threading.Lock()
5248
self._ensure_file()
5349

tests/destination/unit/test_local_certificate_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
def client(tmp_path, monkeypatch):
1616
"""Create a LocalDevCertificateClient backed by a temp directory."""
1717
monkeypatch.setattr(
18-
"sap_cloud_sdk.destination._local_client_base.os.path.abspath",
19-
lambda _: str(tmp_path),
18+
"sap_cloud_sdk.destination._local_client_base.os.getcwd",
19+
lambda: str(tmp_path),
2020
)
2121
return LocalDevCertificateClient()
2222

tests/destination/unit/test_local_destination_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
def client(tmp_path, monkeypatch):
1616
"""Create a LocalDevDestinationClient backed by a temp directory."""
1717
monkeypatch.setattr(
18-
"sap_cloud_sdk.destination._local_client_base.os.path.abspath",
19-
lambda _: str(tmp_path),
18+
"sap_cloud_sdk.destination._local_client_base.os.getcwd",
19+
lambda: str(tmp_path),
2020
)
2121
return LocalDevDestinationClient()
2222

tests/destination/unit/test_local_fragment_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
def client(tmp_path, monkeypatch):
1515
"""Create a LocalDevFragmentClient backed by a temp directory."""
1616
monkeypatch.setattr(
17-
"sap_cloud_sdk.destination._local_client_base.os.path.abspath",
18-
lambda _: str(tmp_path),
17+
"sap_cloud_sdk.destination._local_client_base.os.getcwd",
18+
lambda: str(tmp_path),
1919
)
2020
return LocalDevFragmentClient()
2121

0 commit comments

Comments
 (0)