File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,23 @@ def add_ctsm_systests_to_path(standalone_only=False):
105105 sys .path .insert (1 , ctsm_systest_dir )
106106
107107
108+ def add_fates_testing_to_path ():
109+ """Adds the FATES testing dir to the python path, to allow importing Python modules from there
110+ """
111+ fates_testing_path = os .path .join (
112+ os .path .dirname (__file__ ),
113+ os .pardir ,
114+ os .pardir ,
115+ "src" ,
116+ "fates" ,
117+ "testing" ,
118+ )
119+ if not os .path .exists (fates_testing_path ):
120+ raise RuntimeError (f"src_path not found: '{ fates_testing_path } '" )
121+ prepend_to_python_path (fates_testing_path )
122+ sys .path .insert (1 , fates_testing_path )
123+
124+
108125# ========================================================================
109126# Private functions
110127# ========================================================================
Original file line number Diff line number Diff line change 2424)
2525from ctsm .machine_defaults import MACHINE_DEFAULTS
2626from ctsm .os_utils import make_link
27- from ctsm .path_utils import path_to_ctsm_root
27+ from ctsm .path_utils import path_to_ctsm_root , add_fates_testing_to_path
2828from ctsm .joblauncher .job_launcher_factory import JOB_LAUNCHER_NOBATCH
2929
3030logger = logging .getLogger (__name__ )
@@ -749,6 +749,14 @@ def _check_py_env(test_attributes):
749749 except ModuleNotFoundError as err :
750750 raise ModuleNotFoundError ("modify_fsurdat" + err_msg ) from err
751751
752+ # Check requirements for FUNITFATES, if needed
753+ if any ("FUNITFATES" in t for t in test_attributes ):
754+ add_fates_testing_to_path ()
755+ try :
756+ import run_unit_tests
757+ except ModuleNotFoundError as err :
758+ raise ModuleNotFoundError ("FATES run_unit_tests" + err_msg ) from err
759+
752760 # Check requirements for RXCROPMATURITY, if needed
753761 if any ("RXCROPMATURITY" in t for t in test_attributes ):
754762 try :
You can’t perform that action at this time.
0 commit comments