Skip to content

Commit 6d1a572

Browse files
committed
test: derive XDG temp path via tempfile.gettempdir() (Ruff S108)
CodeRabbit flagged the hardcoded `/tmp/some-xdg-root` literal in test_uses_xdg_state_home_when_set: it's Linux-specific and trips Ruff's S108 (hardcoded-tmp-directory) lint. Derive the path from tempfile.gettempdir() and join with os.path.join so the test runs on Windows / macOS too and stays lint-clean.
1 parent c1ae9d1 commit 6d1a572

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tests/test_cli_export_e2e.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,11 @@ def tearDown(self):
134134
os.environ["XDG_STATE_HOME"] = self._prior
135135

136136
def test_uses_xdg_state_home_when_set(self):
137-
os.environ["XDG_STATE_HOME"] = "/tmp/some-xdg-root"
137+
xdg_root = os.path.join(tempfile.gettempdir(), "some-xdg-root")
138+
os.environ["XDG_STATE_HOME"] = xdg_root
138139
self.assertEqual(
139140
export_script.get_global_state_dir(),
140-
"/tmp/some-xdg-root/cursor-chat-browser",
141+
os.path.join(xdg_root, "cursor-chat-browser"),
141142
)
142143

143144
def test_falls_back_to_home_when_xdg_unset(self):

0 commit comments

Comments
 (0)