Skip to content

Commit 93155ee

Browse files
committed
debug ci: separate cache for each test-case
1 parent b4ff0b2 commit 93155ee

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

openml/testing.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import os
88
import pathlib
99
import shutil
10+
import tempfile
1011
import time
1112
import unittest
1213
from pathlib import Path
@@ -86,7 +87,10 @@ def setUp(self, n_levels: int = 1, tmpdir_suffix: str = "") -> None:
8687
f"Cannot find test cache dir, expected it to be {static_cache_dir}!",
8788
)
8889

89-
self.static_cache_dir = static_cache_dir
90+
self._temp_dir = tempfile.TemporaryDirectory()
91+
self.static_cache_dir = Path(self._temp_dir.name)
92+
shutil.copytree(static_cache_dir, self.static_cache_dir, dirs_exist_ok=True)
93+
9094
self.cwd = Path.cwd()
9195
workdir = Path(__file__).parent.absolute()
9296
tmp_dir_name = self.id() + tmpdir_suffix
@@ -121,6 +125,7 @@ def tearDown(self) -> None:
121125
if os.name != "nt":
122126
# one of the files may still be used by another process
123127
raise e
128+
self._temp_dir.cleanup()
124129

125130
openml.config.connection_n_retries = self.connection_n_retries
126131
openml.config.retry_policy = self.retry_policy

0 commit comments

Comments
 (0)