Ignore:
Timestamp:
Oct 15, 2018 8:38:37 PM (6 years ago)
Author:
knoop
Message:

Improvements to palmtest and reduction of netcdf file check precission for profiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palmtest

    r3353 r3354  
    6666
    6767try:
    68     from termcolor import colored
     68    from termcolor import colored as tcolored
    6969except ImportError:
    70     def colored(string, color):
     70    def tcolored(string, color):
    7171        return string
    7272
    73 
    74 version = '1.0.0'
     73disable_colored_output = False
     74
     75
     76def colored(string, color):
     77    if not disable_colored_output:
     78        return tcolored(string, color)
     79    else:
     80        return string
     81
     82
     83version = '1.0.1'
    7584
    7685scripts_dir = os.path.dirname(os.path.realpath(__file__))
     
    8897hline = '#' * min(terminal_columns, 300) + '\n'
    8998table_width_intro = 12
    90 table_width_builds = len(max([s for s in next(os.walk(trunk_tests_builds_dir))[1]], key=len)) + len('_debug')
    91 table_width_cases = len(max([s for s in next(os.walk(trunk_tests_cases_dir))[1]], key=len))
     99table_width_builds = len(max([s for s in next(os.walk(trunk_tests_builds_dir))[1] if not s[0] == '.'], key=len)) + len('_debug')
     100table_width_cases = len(max([s for s in next(os.walk(trunk_tests_cases_dir))[1] if not s[0] == '.'], key=len))
    92101table_width_cores = 7
    93102table_width_total = table_width_intro + table_width_builds + table_width_cases + table_width_cores + 3
     
    954963        self.fail_on_debug = args.fail_on_debug
    955964        self.dry_run = args.dry_run
     965        self.no_color = args.no_color
    956966        self.test_id = args.test_id
    957967        self.test_case_names = args.cases
     
    962972
    963973    def prepare(self):
     974        global disable_colored_output
     975        disable_colored_output = self.no_color
    964976        self.test_dir = os.path.join(tests_dir, self.test_id)
    965977        try:
     
    10011013
    10021014            if 'all' in self.requested_build_names:
    1003                 self.requested_build_names = [name for name in next(os.walk(trunk_tests_builds_dir))[1]]
     1015                self.requested_build_names = [name for name in next(os.walk(trunk_tests_builds_dir))[1] if not name[0] == '.']
    10041016            found_build_names = []
    10051017            for build_name in self.requested_build_names:
     
    10171029
    10181030            if 'all' in self.test_case_names:
    1019                 self.test_case_names = sorted([name for name in next(os.walk(trunk_tests_cases_dir))[1]])
     1031                self.test_case_names = sorted([name for name in next(os.walk(trunk_tests_cases_dir))[1] if not name[0] == '.'])
    10201032
    10211033            additional_initial_runs_2 = [self.test_case_names]
     
    12271239                        if j and (jd or jd is None):
    12281240                            n_failed += 1
    1229             logger.to_all(r.format('Tests:', n_all, n_ok, n_debugged, n_failed))
     1241            logger.to_all(r.format('Tests:', n_all, n_ok, n_debugged, n_failed) + '\n')
    12301242            total_failed += n_failed
    12311243            total_debugged += n_debugged
     
    12511263
    12521264    def get_items(self):
    1253         case_names = [name for name in next(os.walk(trunk_tests_cases_dir))[1]]
     1265        case_names = [name for name in next(os.walk(trunk_tests_cases_dir))[1] if not name[0] == '.']
    12541266        return case_names + ['all']
    12551267
     
    12581270
    12591271    def get_items(self):
    1260         build_names = [name for name in next(os.walk(trunk_tests_builds_dir))[1]]
     1272        build_names = [name for name in next(os.walk(trunk_tests_builds_dir))[1] if not name[0] == '.']
    12611273        return build_names + ['all']
    12621274
     
    13101322            dest='dry_run',
    13111323            help='Prepare and process all requested tests without actually building or executing PALM.',
     1324            required=False,
     1325        )
     1326        self.add_argument(
     1327            '--no-color',
     1328            action='store_true',
     1329            dest='no_color',
     1330            help='Disable colored terminal output.',
    13121331            required=False,
    13131332        )
Note: See TracChangeset for help on using the changeset viewer.