Skip to content

Commit ea37d02

Browse files
committed
make tempdir platform independent
1 parent 7435d2f commit ea37d02

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/test_integration_xcebra.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@
1616

1717
@pytest.fixture
1818
def synthetic_data():
19-
import os
19+
import tempfile
2020
import urllib.request
21+
from pathlib import Path
2122

2223
url = "https://cebra.fra1.digitaloceanspaces.com/xcebra_synthetic_data.pkl"
23-
filepath = "/tmp/synthetic_data.pkl"
2424

25-
if not os.path.exists(filepath):
25+
# Create a persistent temp directory specific to this test
26+
temp_dir = Path(tempfile.gettempdir()) / "cebra_test_data"
27+
temp_dir.mkdir(exist_ok=True)
28+
filepath = temp_dir / "synthetic_data.pkl"
29+
30+
if not filepath.exists():
2631
urllib.request.urlretrieve(url, filepath)
2732

28-
with open(filepath, 'rb') as file:
33+
with filepath.open('rb') as file:
2934
return pickle.load(file)
3035

3136

0 commit comments

Comments
 (0)