示例#1
0
 def test_log_output_depth_one(self):
     with no_stderrout():
         paths = self.make_paths()
         inputs = link_inputs(paths,
                              ['test/raw/log_sources/move_depth.txt'])
         write_source_logs(paths, inputs, depth=1)
         self.assertIn('depth_1.txt', read_file(paths['source_statslog']))
         self.assertIn('depth_2.txt', read_file(paths['source_statslog']))
示例#2
0
 def test_log_output_character(self):
     with no_stderrout():
         paths = self.make_paths()
         inputs = link_inputs(paths, ['test/raw/log_sources/move_╬▓.txt'])
         write_source_logs(paths, inputs)
         self.check_makelog(paths)
         self.assertIn('dir_╬▓', read_file(paths['source_maplog']))
         self.assertIn('file_╬▓.txt', read_file(paths['source_statslog']))
示例#3
0
 def test_error_bad_path(self):
     with no_stderrout():
         try:
             paths = {}
             inputs = link_inputs(paths,
                                  ['test/raw/log_sources/move space.txt'])
             write_source_logs(paths, inputs)
         except Exception as e:
             self.assertRaises(Exception, e)
示例#4
0
 def test_log_output_no_log(self):
     with no_stderrout():
         paths = self.make_paths(source_maplog_path='',
                                 source_statslog_path='')
         inputs = link_inputs(paths,
                              ['test/raw/log_sources/move space.txt'])
         write_source_logs(paths, inputs)
         self.check_makelog(paths)
         self.assertFalse(os.path.isfile(paths['source_maplog']))
         self.assertFalse(os.path.isfile(paths['source_statslog']))
示例#5
0
 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 = self.make_paths()
         inputs = link_inputs(paths,
                              ['test/raw/log_sources/move_recursion.txt'])
         write_source_logs(paths, inputs)
示例#6
0
文件: make.py 项目: gentzkow/template
### 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)

### END MAKE
gs.end_makelog(PATHS)
示例#7
0
 def test_log_output(self):
     with no_stderrout():
         paths = self.make_paths()
         inputs = link_inputs(paths, ['test/raw/log_sources/move.txt'])
         write_source_logs(paths, inputs)
         self.check_logs(paths)