def test_for_unrecognized_values(self): """qiime_config has no extra values""" error_msg_fragment = (" contains unrecognized values:\n%s\nYou can " "safely remove these values from your QIIME " "config file as they will be ignored by QIIME.") qiime_project_dir = get_qiime_project_dir() orig_config = parse_qiime_config_file(open(qiime_project_dir + '/qiime/support_files/qiime_config')) # check the env qiime_config qiime_config_env_filepath = getenv('QIIME_CONFIG_FP') if qiime_config_env_filepath: qiime_config_via_env = parse_qiime_config_file( open(qiime_config_env_filepath)) extra_vals = [] for key in qiime_config_via_env: if key not in orig_config: extra_vals.append(key) if extra_vals: self.fail("The QIIME config file set via the QIIME_CONFIG_FP " "environment variable" + error_msg_fragment % ", ".join(extra_vals)) # check the qiime_config in $HOME/.qiime_config home_dir = getenv('HOME') if (exists(home_dir + "/.qiime_config")): qiime_config_home = parse_qiime_config_file( open(home_dir + "/.qiime_config")) extra_vals = [] for key in qiime_config_home: if key not in orig_config: extra_vals.append(key) if extra_vals: self.fail("The .qiime_config in your HOME" + error_msg_fragment % ", ".join(extra_vals))
def test_for_obsolete_values(self): """local qiime_config has no extra params""" qiime_project_dir = get_qiime_project_dir() orig_config = parse_qiime_config_file(open(qiime_project_dir + '/qiime/support_files/qiime_config')) #check the env qiime_config qiime_config_env_filepath = getenv('QIIME_CONFIG_FP') if qiime_config_env_filepath: qiime_config_via_env= parse_qiime_config_file(open(qiime_config_env_filepath)) extra_vals = [] for key in qiime_config_via_env: if key not in orig_config: extra_vals.append(key) if extra_vals: self.fail("The qiime_config file set via QIIME_CONFIG_FP"+ "enviroment variable contains obsolete parameters:\n"+ ", ".join(extra_vals)) # check the qiime_config in $HOME/.qiime_config home_dir = getenv('HOME') if (exists(home_dir+"/.qiime_config")): qiime_config_home = parse_qiime_config_file(open(home_dir+"/.qiime_config")) extra_vals = [] for key in qiime_config_home: if key not in orig_config: extra_vals.append(key) if extra_vals: self.fail("The .qiime_config in your HOME contains obsolete "+ "parameters:\n" + ", ".join(extra_vals))
def test_for_unrecognized_values(self): """qiime_config has no extra values""" error_msg_fragment = (" contains unrecognized values:\n%s\nYou can " "safely remove these values from your QIIME " "config file as they will be ignored by QIIME.") qiime_project_dir = get_qiime_project_dir() orig_config = parse_qiime_config_file( open(qiime_project_dir + '/qiime/support_files/qiime_config')) # check the env qiime_config qiime_config_env_filepath = getenv('QIIME_CONFIG_FP') if qiime_config_env_filepath: qiime_config_via_env = parse_qiime_config_file( open(qiime_config_env_filepath)) extra_vals = [] for key in qiime_config_via_env: if key not in orig_config: extra_vals.append(key) if extra_vals: self.fail("The QIIME config file set via the QIIME_CONFIG_FP " "environment variable" + error_msg_fragment % ", ".join(extra_vals)) # check the qiime_config in $HOME/.qiime_config home_dir = getenv('HOME') if (exists(home_dir + "/.qiime_config")): qiime_config_home = parse_qiime_config_file( open(home_dir + "/.qiime_config")) extra_vals = [] for key in qiime_config_home: if key not in orig_config: extra_vals.append(key) if extra_vals: self.fail("The .qiime_config in your HOME" + error_msg_fragment % ", ".join(extra_vals))