Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 62ae60f

Browse files
committed
E2E: Test XDG directory folder path on Linux
1 parent 155a5b0 commit 62ae60f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

engine/e2e-test/cli/common/test_create_log_folder.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,21 @@
66
from utils.test_runner import start_server, stop_server
77

88

9+
def get_root_path():
10+
if platform.system() == "Linux":
11+
# For Linux, use the XDG base directory.
12+
# Here we use XDG_DATA_HOME if set, otherwise default to ~/.local/share.
13+
return Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share"))
14+
else:
15+
return Path.home()
16+
17+
918
class TestCreateLogFolder:
1019
@pytest.fixture(autouse=True)
1120
def setup_and_teardown(self):
1221
# Setup
1322
stop_server()
14-
root = Path.home()
23+
root = get_root_path()
1524
if os.path.exists(root / "cortexcpp" / "logs"):
1625
shutil.rmtree(root / "cortexcpp" / "logs")
1726
success = start_server()
@@ -24,7 +33,7 @@ def setup_and_teardown(self):
2433
stop_server()
2534

2635
def test_create_log_folder_run_successfully(self):
27-
root = Path.home()
36+
root = get_root_path()
2837
assert (
2938
os.path.exists(root / "cortexcpp" / "logs")
3039
or os.path.exists(root / "cortexcpp-beta" / "logs")

0 commit comments

Comments
 (0)