def make_paths(self, makelog_path = 'test/log/make.log'): paths = {'makelog': makelog_path} with no_stderrout(): start_makelog(paths) return(paths)
def test_error_bad_paths(self): with self.assertRaises(Exception): with no_stderrout(): paths = {} start_makelog(paths) write_to_makelog(paths, 'Hello, World!') end_makelog(paths)
def test_makelog_space(self): with no_stderrout(): paths = self.make_paths(makelog_path='test/log/make space.log') start_makelog(paths) write_to_makelog(paths, 'Hello, World!') end_makelog(paths) self.check_makelog(paths)
def test_makelog_character(self): with no_stderrout(): paths = self.make_paths(makelog_path='test/log/make_╬▓.log') start_makelog(paths) write_to_makelog(paths, 'Hello, World! ╬▓') end_makelog(paths) self.check_makelog(paths)
def test_makelog(self): with no_stderrout(): paths = self.make_paths() start_makelog(paths) write_to_makelog(paths, 'Hello, World!') end_makelog(paths) self.check_makelog(paths)
def make_paths(self, makelog_path='test/log/make.log', output_dir='test/output'): paths = {'makelog': makelog_path, 'output_dir': output_dir} with no_stderrout(): start_makelog(paths) return (paths)
def make_paths(self, makelog_path = 'test/log/make.log', input_path = 'test/input/', external_path = 'test/external/'): paths = {'makelog': makelog_path, 'input_dir': input_path, 'external_dir': external_path} with no_stderrout(): start_makelog(paths) return(paths)
def make_paths(self, makelog_path='test/log/make.log', input_path='test/input/', source_maplog_path='test/log/source_map.log', source_statslog_path='test/log/source_stats.log'): paths = { 'makelog': makelog_path, 'input_dir': input_path, 'source_maplog': source_maplog_path, 'source_statslog': source_statslog_path } with no_stderrout(): start_makelog(paths) return (paths)
def make_paths(self, output_path, output_local_path=[], makelog_path='test/log/make.log', output_statslog='test/log/output_stats.log'): paths = { 'makelog': makelog_path, 'output_dir': output_path, 'output_local_dir': output_local_path, 'output_statslog': output_statslog } with no_stderrout(): start_makelog(paths) return (paths)
def test_log_output_depth_recursive(self): """ Note ---- For some reason, recursive symlinks don't actually break as expected. Python just stops walking the recursive directory at a certain point. """ with no_stderrout(): paths = { 'makelog': 'test/log/make.log', 'input_dir': 'test/input', 'output_dir': 'test/input', 'output_statslog': 'test/log/output_stats.log' } start_makelog(paths) link_inputs(paths, ['test/raw/log_outputs/recursion.txt']) log_files_in_output(paths)
### PULL PATHS FROM CONFIG PATHS = {'root': ROOT, 'config': os.path.join(ROOT, 'config.yaml')} PATHS = gs.update_internal_paths(PATHS) ### LOAD CONFIG USER PATHS = gs.update_external_paths(PATHS) gs.update_executables(PATHS) ############ ### MAKE ### ############ ### START MAKE gs.remove_dir(['input', 'external']) gs.clear_dir(['output', 'log']) gs.start_makelog(PATHS) ### MAKE LINKS TO INPUT AND EXTERNAL FILES inputs = gs.link_inputs(PATHS, ['input.txt']) externals = gs.link_externals(PATHS, ['external.txt']) gs.write_source_logs(PATHS, inputs + externals) gs.get_modified_sources(PATHS, inputs + externals) ### RUN SCRIPTS gs.run_stata(PATHS, 'code/analyze_data.do') ### LOG OUTPUTS gs.log_files_in_output(PATHS) ### CHECK FILE SIZES gs.check_module_size(PATHS)