Beispiel #1
0
 def mock_run(args):
     logger.info('Calling run with %r', args)
     res = subprocess.call(args)
     if res != 0:
         raise CalledProcessError(
             message='Sed fails with error code {!r}'.format(res),
             command=args,
             result=res,
         )
Beispiel #2
0
def raise_call_error(args=None):
    raise CalledProcessError(message='A Leapp Command Error occured.',
                             command=args,
                             result={
                                 'signal': None,
                                 'exit_code': 1,
                                 'pid': 0,
                                 'stdout': 'fake',
                                 'stderr': 'fake'
                             })
Beispiel #3
0
def raise_call_error(args=None, exit_code=1):
    raise CalledProcessError(
        message='Command {0} failed with exit code {1}.'.format(
            str(args), exit_code),
        command=args,
        result={
            'signal': None,
            'exit_code': exit_code,
            'pid': 0,
            'stdout': 'fake out',
            'stderr': 'fake err'
        })
 def __call__(self, *args):
     self.called += 1
     self.args.append(args)
     if self.raise_err:
         raise CalledProcessError(message='A Leapp Command Error occured.',
                                  command=args,
                                  result={
                                      'signal': None,
                                      'exit_code': 1,
                                      'pid': 0,
                                      'stdout': 'fake',
                                      'stderr': 'fake'
                                  })
Beispiel #5
0
 def __call__(self, args, split=True):
     raise CalledProcessError(self, 1, "Mock error ;)")