예제 #1
0
 def test_log_output_no_log(self):
     with no_stderrout():
         paths = self.make_paths(output_path='test/raw/log_outputs/dir',
                                 output_statslog='')
         log_files_in_output(paths)
         self.check_makelog(paths)
         self.assertFalse(os.path.isfile(paths['output_statslog']))
예제 #2
0
 def test_log_output_depth_one(self):
     with no_stderrout():
         paths = self.make_paths(
             output_path='test/raw/log_outputs/dir_depth')
         log_files_in_output(paths, depth=1)
         self.assertIn('depth_1.txt', read_file(paths['output_statslog']))
         self.assertIn('depth_2.txt', read_file(paths['output_statslog']))
예제 #3
0
 def test_log_output_space(self):
     with no_stderrout():
         paths = self.make_paths(
             output_path='test/raw/log_outputs/dir space')
         log_files_in_output(paths)
         self.check_makelog(paths)
         self.assertIn('file space.txt',
                       read_file(paths['output_statslog']))
예제 #4
0
 def test_error_bad_path(self):
     with no_stderrout():
         try:
             paths = {}
             log_files_in_output(paths)
             self.check_logs(paths)
         except Exception as e:
             self.assertRaises(Exception, e)
예제 #5
0
 def test_log_output_local_string(self):
     with no_stderrout():
         paths = self.make_paths(
             output_path='test/raw/log_outputs/dir',
             output_local_path='test/raw/log_outputs/dir_local')
         log_files_in_output(paths)
         self.check_logs(paths)
         self.assertIn('file_local.txt',
                       read_file(paths['output_statslog']))
예제 #6
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 = {
                '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)
예제 #7
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)
예제 #8
0
 def test_log_output(self):
     with no_stderrout():
         paths = self.make_paths(output_path='test/raw/log_outputs/dir')
         log_files_in_output(paths)
         self.check_logs(paths)