def test_exits_gracefully_when_ciftify_data_dir_doesnt_exist( self, mock_ciftify, mock_fsl, mock_exists): ciftify_data = '/somepath/ciftify/data' # This is to avoid test failure if shell environment changes mock_ciftify.return_value = ciftify_data mock_fsl.return_value = '/somepath/FSL' mock_exists.side_effect = lambda path: False if path == ciftify_data else True settings = utils.WorkFlowSettings(self.arguments) assert False
def test_exits_gracefully_when_fsl_dir_cannot_be_found( self, mock_ciftify, mock_fsl, mock_exists): # This is to avoid test failure if shell environment changes mock_ciftify.return_value = '/somepath/ciftify/data' # This is to avoid sys.exit calls due to the mock directories not # existing. mock_exists.return_value = True mock_fsl.return_value = None with pytest.raises(SystemExit): settings = utils.WorkFlowSettings(self.arguments)
def test_default_config_read_when_no_config_yaml_given( self, mock_fsl, mock_exists): # This is to avoid test failure if shell environment changes mock_fsl.return_value = '/somepath/FSL' # This is to avoid sys.exit calls due to mock directories not # existing. mock_exists.return_value = True settings = utils.WorkFlowSettings(self.arguments) config = settings._WorkFlowSettings__config assert config is not None
def test_exits_gracefully_when_fsl_dir_cannot_be_found( self, mock_ciftify, mock_fsl, mock_exists): # This is to avoid test failure if shell environment changes mock_ciftify.return_value = '/somepath/ciftify/data' # This is to avoid sys.exit calls due to the mock directories not # existing. mock_exists.return_value = True mock_fsl.return_value = None settings = utils.WorkFlowSettings(self.arguments) # Should never reach this line assert False
def test_exits_gracefully_when_yaml_config_file_doesnt_exist( self, mock_ciftify, mock_fsl, mock_exists): # This is to avoid test failure if shell environment changes mock_ciftify.return_value = '/somepath/ciftify/data' mock_fsl.return_value = '/somepath/FSL' yaml_file = '/somepath/fake_config.yaml' mock_exists.side_effect = lambda path: False if path == yaml_file else True # work with a deep copy of arguments to avoid modifications having any # effect on later tests args_copy = copy.deepcopy(self.arguments) args_copy['--ciftify-conf'] = yaml_file with pytest.raises(SystemExit): settings = utils.WorkFlowSettings(args_copy)