File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 1414
1515import io
1616import os
17- import pathlib
1817import platform
1918import shlex
2019import shutil
@@ -65,7 +64,7 @@ def get_default_samples_dir():
6564 elif platform .system () == "Windows" and "PUBLIC" in os .environ :
6665 samples_dir = os .path .join (os .environ ["PUBLIC" ], "khiops_data" , "samples" )
6766 else :
68- samples_dir = str ( pathlib . Path . home () / "khiops_data" / "samples" )
67+ samples_dir = os . path . join ( os . environ [ "HOME" ], "khiops_data" , "samples" )
6968 return samples_dir
7069
7170
Original file line number Diff line number Diff line change @@ -227,6 +227,27 @@ def test_train_predictor_fail_and_log_with_remote_access(self):
227227 self .assertTrue (fs .exists (log_file_path ), f"Path: { log_file_path } " )
228228 fs .remove (log_file_path )
229229
230+ def test_samples_dir_inferred_from_remote_home (self ):
231+ """Test either samples_dir is correctly inferred
232+ using a remote path in HOME
233+ """
234+
235+ # Save initial state
236+ # This runner has remote paths (for root_temp_dir for example)
237+ initial_runner = kh .get_runner ()
238+ initial_home = os .environ .get ("HOME" )
239+
240+ # Set a remote path to HOME
241+ os .environ ["HOME" ] = initial_runner .root_temp_dir
242+ test_runner = KhiopsLocalRunner ()
243+ kh .set_runner (test_runner )
244+
245+ print (f"Inferred sample_dir is { test_runner .samples_dir } " )
246+
247+ # Restore initial state
248+ os .environ ["HOME" ] = initial_home
249+ kh .set_runner (initial_runner )
250+
230251
231252class KhiopsS3RemoteFileTests (KhiopsRemoteAccessTestsContainer .KhiopsRemoteAccessTests ):
232253 """Integration tests with Amazon S3 filesystems"""
You can’t perform that action at this time.
0 commit comments