def test_welch_chained(): input_dir = 'testsuite/data' exp_name = 'run_chained' files_generated = utils.generate_data(input_dir, exp_name, '2d_A', 'TSURF') files_generated.extend( utils.generate_data(input_dir, exp_name, '2d_B', 'T2M')) cmd = 'python paths_init.py -pr {} -ts'.format(input_dir) status, _ = utils.shell_cmd(cmd) assert status == 0, 'paths_init.py failed' cmd = 'python process_data.py -e {} -t welch --spinup 0 \ --p_stages testsuite/stages \ --wrkdir testsuite/workdir \ --f_vars_to_extract vars_welchs_test.csv \ -c'.format(exp_name) status, _ = utils.shell_cmd(cmd) assert status == 0, 'process_data.py failed' cmd = 'python perform_test.py -e {} -t welch \ --p_stages testsuite/stages \ --wrkdir testsuite/workdir \ --p_ref_csv_files testsuite/ref --f_vars_to_extract \ vars_welchs_test.csv -ts'.format(exp_name) status, _ = utils.shell_cmd(cmd) utils.delete_data(files_generated) assert status == 0, 'perform_test.py failed'
def test_emi_embed(): input_dir = 'testsuite/data' exp_name = 'run_embed' files_generated = utils.generate_data(input_dir, exp_name, 'emi_A', 'SO2') files_generated.extend( utils.generate_data(input_dir, exp_name, 'emi_B', 'CO2')) cmd = 'python paths_init.py -pr {} -ts'.format(input_dir) status, _ = utils.shell_cmd(cmd) assert status == 0, 'paths_init.py failed' cmd = 'python sanity_test.py -v -e {} -t emi \ --p_ref_csv_files testsuite/ref \ --f_vars_to_extract vars_emi_test.csv \ --p_stages testsuite/stages \ --wrkdir testsuite/workdir \ --spinup 0 -c -ts'.format(exp_name) status, _ = utils.shell_cmd(cmd) utils.delete_data(files_generated) assert status == 0, 'sanity_test.py failed'
def test_fldcor_chained(): input_dir = 'testsuite/data' exp_name = 'run_chained' files_generated = [] os.makedirs('testsuite/stages', exist_ok=True) standard_postproc = 'testsuite/stages/standard_postproc_rmse_{}.nc'\ .format(exp_name) files_generated.append(standard_postproc) file_with_ftp_link = ('testsuite/variables_to_process/rmse' '/ftp_fake_postproc.txt') cmd = ('wget --quiet --input-file={} ' '--output-document={}'.format(file_with_ftp_link, standard_postproc)) status, _ = utils.shell_cmd(cmd) assert status == 0, 'Could not download reference from ftp-server' cmd = 'python paths_init.py -pr {} -ts'.format(input_dir) status, _ = utils.shell_cmd(cmd) assert status == 0, 'paths_init.py failed' cmd = 'python process_data.py -v -e {} -t rmse \ --p_stages testsuite/stages \ --wrkdir testsuite/workdir \ --f_vars_to_extract vars_rmse_test.csv '.format(exp_name) status, _ = utils.shell_cmd(cmd) assert status == 0, 'process_data.py failed' cmd = 'python perform_test.py -v -e {} -t rmse \ --p_stages testsuite/stages \ --wrkdir testsuite/workdir \ --p_ref_csv_files testsuite/ref --f_vars_to_extract \ vars_rmse_test.csv -ts'.format(exp_name) status, _ = utils.shell_cmd(cmd) utils.delete_data(files_generated) assert status == 0, 'perform_test.py failed'
def test_testsuite(): cmd = 'python testsuite/pycodestyle.py \ --ignore=E225,E265,W291,E201,E221,E231,E241,E722,W504 \ testsuite/*.py' status, _ = utils.shell_cmd(cmd) assert status == 0, 'Violations of Pep-8-standard found!'
def test_lib(): cmd = 'python testsuite/pycodestyle.py --exclude=paths.py \ --ignore=E265,W291,E201,E221,E231,E241,E722,W504,E731 \ lib/*.py' status, _ = utils.shell_cmd(cmd) assert status == 0, 'Violations of Pep-8-standard found!'
def test_main(): cmd = 'python testsuite/pycodestyle.py \ --exclude=prepare_csvfiles_ref_echam.py \ --ignore=E265,W291,E201,E221,E231,E241,E722,W504 *.py' status, _ = utils.shell_cmd(cmd) assert status == 0, 'Violations of Pep-8-standard found!'