Ejemplo n.º 1
0
 def command(self):
     cmd = [sys.executable]
     #
     # PYTHON FLAGS
     #
     #     -u     : force the stdout and stderr streams to be unbuffered; same as PYTHONUNBUFFERED=1
     # With buffering we may end up losing output in case of crashes! (in Python 3.7 the text layer of the
     # streams is unbuffered, but we assume 3.6)
     cmd += ['-u']
     #
     if sys.flags.verbose:
         cmd += ["-v"]
     #
     cmd += [self.path_to_script]
     #
     # SCRIPT FLAGS
     #
     # If the script has a custom-arguments flag, then we don't pass any of the standard options
     if 'custom-args' not in self.config.flags:
         #
         if log.is_debug_on():
             cmd += ['--debug']
         #
         if log.is_color_on():
             cmd += ['--color']
         #
         if self.config.context:
             cmd += ['--context', self.config.context]
     return cmd
Ejemplo n.º 2
0
def test_wrapper(test, configuration=None, repetition=1):
    global n_tests, rslog
    n_tests += 1
    #
    if not log.is_debug_on() or log.is_color_on():
        log.progress(
            configuration_str(configuration, repetition, suffix=' ') +
            test.name, '...')
    #
    log_path = test.get_log()
    #
    opts = set()
    if rslog:
        opts.add('--rslog')
    try:
        test.run_test(configuration=configuration,
                      log_path=log_path,
                      opts=opts)
    except FileNotFoundError as e:
        log.e(
            log.red + test.name + log.reset + ':',
            str(e) + configuration_str(configuration, repetition, prefix=' '))
    except subprocess.TimeoutExpired:
        log.e(
            log.red + test.name + log.reset + ':',
            configuration_str(configuration, repetition, suffix=' ') +
            'timed out')
    except subprocess.CalledProcessError as cpe:
        if not check_log_for_fails(log_path, test.name, configuration,
                                   repetition):
            # An unexpected error occurred
            log.e(
                log.red + test.name + log.reset + ':',
                configuration_str(configuration, repetition, suffix=' ') +
                'exited with non-zero value (' + str(cpe.returncode) + ')')
Ejemplo n.º 3
0
def test_wrapper( test, configuration = None ):
    global n_tests
    n_tests += 1
    if not log.is_debug_on()  or  log.is_color_on():
        if configuration:
            log.progress( '[' + ' '.join( configuration ) + ']', test.name, '...' )
        else:
            log.progress( test.name, '...' )
    test.run_test()
Ejemplo n.º 4
0
 def command(self):
     cmd = [self.exe]
     if 'custom-args' not in self.config.flags:
         # Assume we're a Catch2 exe, so:
         # if sys.flags.verbose:
         #    cmd +=
         if log.is_debug_on():
             cmd += ['-d', 'yes']  # show durations for each test-case
             # cmd += ['--success']  # show successful assertions in output
         # if log.is_color_on():
         #    cmd += ['--use-colour', 'yes']
     return cmd
Ejemplo n.º 5
0
 def command(self):
     cmd = [sys.executable]
     # The unit-tests should only find module we've specifically added -- but Python may have site packages
     # that are automatically made available. We want to avoid those:
     #     -S     : don't imply 'import site' on initialization
     # NOTE: exit() is defined in site.py and works only if the site module is imported!
     cmd += ['-S']
     if sys.flags.verbose:
         cmd += ["-v"]
     cmd += [self.path_to_script]
     if log.is_debug_on():
         cmd += ['--debug']
     if log.is_color_on():
         cmd += ['--color']
     return cmd
Ejemplo n.º 6
0
 def command( self ):
     cmd = [sys.executable]
     # The unit-tests should only find module we've specifically added -- but Python may have site packages
     # that are automatically made available. We want to avoid those:
     #     -S     : don't imply 'import site' on initialization
     # NOTE: exit() is defined in site.py and works only if the site module is imported!
     cmd += ['-S']
     #     -u     : force the stdout and stderr streams to be unbuffered; same as PYTHONUNBUFFERED=1
     # With buffering we may end up losing output in case of crashes! (in Python 3.7 the text layer of the
     # streams is unbuffered, but we assume 3.6)
     cmd += ['-u']
     if sys.flags.verbose:
         cmd += ["-v"]
     cmd += [self.path_to_script]
     if 'custom-args' not in self.config.flags:
         if log.is_debug_on():
             cmd += ['--debug']
         if log.is_color_on():
             cmd += ['--color']
         if self.config.context:
             cmd += ['--context', self.config.context]
     return cmd