def getProcessOutputAndValueWithInput(executable, args, input):
    "similar to getProcessOutputAndValue, but also allows injection of input on stdin"
    d = defer.Deferred()
    p = _SubprocessProtocol(input, d)

    (executable, args) = encodeExecutableAndArgs(executable, args)
    reactor.spawnProcess(p, executable, (executable,) + tuple(args))
    return d
Пример #2
0
def getProcessOutputAndValueWithInput(executable, args, input):
    "similar to getProcessOutputAndValue, but also allows injection of input on stdin"
    d = defer.Deferred()
    p = _SubprocessProtocol(input, d)

    (executable, args) = encodeExecutableAndArgs(executable, args)
    reactor.spawnProcess(p, executable, (executable, ) + tuple(args))
    return d
    def test_buildbot_cvs_mail_no_args_exits_with_error(self):
        executable = sys.executable
        args = [self.buildbot_cvs_mail_path]
        (executable, args) = encodeExecutableAndArgs(executable, args)
        d = utils.getProcessOutputAndValue(executable, args)

        def check(result):
            (stdout, stderr, code) = result
            self.assertEqual(code, 2)
        d.addCallback(check)
        return d
 def test_buildbot_cvs_mail_from_cvs1_11(self):
     # Simulate CVS 1.11
     executable = sys.executable
     args = [self.buildbot_cvs_mail_path, '--cvsroot=\"ext:example:/cvsroot\"',
             '[email protected]', '-P', 'test', '-R', '*****@*****.**', '-t',
             'test', 'README', '1.1,1.2', 'hello.c', '2.2,2.3']
     (executable, args) = encodeExecutableAndArgs(executable, args)
     d = getProcessOutputAndValueWithInput(executable,
                                           args,
                                           input=test)
     d.addCallback(self.assertOutputOk, golden_1_11_regex)
     return d
Пример #5
0
    def test_buildbot_cvs_mail_no_args_exits_with_error(self):
        executable = sys.executable
        args = [self.buildbot_cvs_mail_path]
        (executable, args) = encodeExecutableAndArgs(executable, args)
        d = utils.getProcessOutputAndValue(executable, args)

        def check(result):
            (stdout, stderr, code) = result
            self.assertEqual(code, 2)

        d.addCallback(check)
        return d
Пример #6
0
 def test_buildbot_cvs_mail_from_cvs1_11(self):
     # Simulate CVS 1.11
     executable = sys.executable
     args = [
         self.buildbot_cvs_mail_path, '--cvsroot=\"ext:example:/cvsroot\"',
         '[email protected]', '-P', 'test', '-R',
         '*****@*****.**', '-t', 'test', 'README', '1.1,1.2',
         'hello.c', '2.2,2.3'
     ]
     (executable, args) = encodeExecutableAndArgs(executable, args)
     d = getProcessOutputAndValueWithInput(executable, args, input=test)
     d.addCallback(self.assertOutputOk, golden_1_11_regex)
     return d
    def test_buildbot_cvs_mail_with_unknown_opt_exits_with_error(self):
        executable = sys.executable
        args = [self.buildbot_cvs_mail_path,
                '[email protected]', '-P', 'test', '--path',
                'test', '-R', '*****@*****.**', '-t',
                'README', '1.1', '1.2', 'hello.c', '2.2', '2.3']
        (executable, args) = encodeExecutableAndArgs(executable, args)
        d = utils.getProcessOutputAndValue(executable, args)

        def check(result):
            (stdout, stderr, code) = result
            self.assertEqual(code, 2)
        d.addCallback(check)
        return d
Пример #8
0
    def test_buildbot_cvs_mail_with_unknown_opt_exits_with_error(self):
        executable = sys.executable
        args = [
            self.buildbot_cvs_mail_path, '[email protected]', '-P',
            'test', '--path', 'test', '-R', '*****@*****.**', '-t',
            'README', '1.1', '1.2', 'hello.c', '2.2', '2.3'
        ]
        (executable, args) = encodeExecutableAndArgs(executable, args)
        d = utils.getProcessOutputAndValue(executable, args)

        def check(result):
            (stdout, stderr, code) = result
            self.assertEqual(code, 2)

        d.addCallback(check)
        return d
Пример #9
0
    def test_buildbot_cvs_mail_without_cvsroot_opt_exits_with_error(self):
        executable = sys.executable
        args = [
            self.buildbot_cvs_mail_path, '--complete-garbage-opt=gomi',
            '--cvsroot=\"ext:example.com:/cvsroot\"',
            '[email protected]', '-P', 'test', '--path', 'test',
            '-R', '*****@*****.**', '-t', 'README', '1.1', '1.2',
            'hello.c', '2.2', '2.3'
        ]
        (executable, args) = encodeExecutableAndArgs(executable, args)
        d = utils.getProcessOutputAndValue(executable, args)

        def check(result):
            _, __, code = result
            self.assertEqual(code, 2)

        d.addCallback(check)
        return d