def test_run_ex_1_caching(): # given global this_dir, logging_conf_fpath sim_conf_fpath = "test_sets/ex_1_full/run_realistic.ini" exp_log_fpath = "test_sets/ex_1_full/exp_log_realistic.txt" floader = fl.FileLoader() # when os.chdir(this_dir) sf.setup_logging(logging_conf_fpath) cs.run(sim_conf_fpath, floader) # then assert sf.compare_files_by_line("log.txt", exp_log_fpath, False) # tear down shutil.rmtree(os.path.join(this_dir, os.path.normpath("test_sets/ex_1_full/res_realistic"))) os.remove(os.path.join(this_dir, os.path.normpath("test_sets/useless/useless_1.tsv"))) # when sf.setup_logging(logging_conf_fpath) cs.run(sim_conf_fpath, floader) # then assert sf.compare_files_by_line("log.txt", exp_log_fpath, False) # tear down shutil.rmtree(os.path.join(this_dir, os.path.normpath("test_sets/ex_1_full/res_realistic"))) os.remove(os.path.join(this_dir, os.path.normpath("test_sets/useless/useless_1.tsv")))
def test_run_ex_3_realistic(): # given global this_dir, logging_conf_fpath sim_conf_fpath = 'test_sets/ex_3_full/run_realistic.ini' exp_log_fpath = 'test_sets/ex_3_full/exp_log_realistic.txt' exp_end_stats_fpath = os.path.normpath( 'test_sets/ex_3_full/exp_end_stats_realistic.tsv') res_end_stats_fpath = os.path.normpath('test_sets/useless/useless_3.tsv') floader = fl.FileLoader() # when os.chdir(this_dir) sf.setup_logging(logging_conf_fpath) cs.run(sim_conf_fpath, floader) # then assert sf.compare_files_by_line('log.txt', exp_log_fpath, False) assert sf.compare_files_by_line(res_end_stats_fpath, exp_end_stats_fpath, False) # tear down shutil.rmtree( os.path.join(this_dir, os.path.normpath('test_sets/ex_3_full/res_realistic'))) os.remove( os.path.join(this_dir, os.path.normpath('test_sets/useless/useless_3.tsv')))
def test_run_ex_unstable_2(): # given global this_dir, logging_conf_fpath sim_conf_fpath = "test_sets/ex_unstable_2/run_uniform.ini" exp_log_fpath = "test_sets/ex_unstable_2/exp_log_uniform.txt" floader = fl.FileLoader() # when os.chdir(this_dir) sf.setup_logging(logging_conf_fpath) cs.run(sim_conf_fpath, floader) # then assert sf.compare_files_by_line("log.txt", exp_log_fpath, False) # tear down shutil.rmtree(os.path.join(this_dir, os.path.normpath("test_sets/ex_unstable_2/res_uniform"))) os.remove(os.path.join(this_dir, os.path.normpath("test_sets/useless/useless_4.tsv")))
def test_run_ex_unstable_2(): # given global this_dir, logging_conf_fpath sim_conf_fpath = 'test_sets/ex_unstable_2/run_uniform.ini' exp_log_fpath = 'test_sets/ex_unstable_2/exp_log_uniform.txt' floader = fl.FileLoader() # when os.chdir(this_dir) sf.setup_logging(logging_conf_fpath) cs.run(sim_conf_fpath, floader) # then assert sf.compare_files_by_line('log.txt', exp_log_fpath, False) # tear down shutil.rmtree( os.path.join(this_dir, os.path.normpath('test_sets/ex_unstable_2/res_uniform'))) os.remove( os.path.join(this_dir, os.path.normpath('test_sets/useless/useless_4.tsv')))