Пример #1
0
 def method(testcase):
     testcase.expectCommands(Expect("command"))
     testcase.expectCommands(Expect("command2"))
     d = utils.getProcessOutputAndValue("command", ())
     d.addCallback(self.assertEqual, ('', '', 0))
     d.addCallback(lambda _: testcase.assertAllCommandsRan())
     return d
Пример #2
0
 def method(testcase):
     testcase.expectCommands(Expect("command"))
     testcase.addGetProcessOutputExpectEnv({'key': 'value'})
     d = utils.getProcessOutput("command", (), env={'key': 'value'})
     d.addCallback(self.assertEqual, '')
     d.addCallback(lambda _: testcase.assertAllCommandsRan())
     return d
Пример #3
0
 def method(testcase):
     testcase.expectCommands(Expect("command"))
     testcase.addGetProcessOutputExpectEnv({'key': 'value'})
     res = yield utils.getProcessOutput("command", (),
                                        env={'key': 'value'})
     self.assertEqual(res, b'')
     testcase.assertAllCommandsRan()
Пример #4
0
        def method(testcase):
            testcase.expectCommands(
                Expect("command").stdout(b"stdout").stderr(b"stderr"))
            res = yield utils.getProcessOutput("command", (), errortoo=True)

            testcase.assertSubstring(b"stdout", res)
            testcase.assertSubstring(b"stderr", res)
Пример #5
0
 def method(testcase):
     testcase.expectCommands(Expect("command").stdout("stdout").stderr("stderr"))
     d = utils.getProcessOutput("command", (), errortoo=True)
     @d.addCallback
     def cb(res):
         testcase.assertSubstring("stdout", res)
         testcase.assertSubstring("stderr", res)
     return d
Пример #6
0
 def method(testcase):
     testcase.expectCommands(Expect("command").stderr("some test"))
     d = testcase.assertFailure(utils.getProcessOutput("command", ()),
                                [IOError])
     return d
Пример #7
0
 def method(testcase):
     testcase.expectCommands(Expect("command", "arg").path("/home"))
     d = utils.getProcessOutput("command", ("otherarg", ))
     d.addCallback(lambda _: testcase.assertAllCommandsRan())
     return d
Пример #8
0
 def method(testcase):
     testcase.expectCommands(Expect("command").stderr(b"some test"))
     res = yield utils.getProcessOutput("command", (), errortoo=True)
     testcase.assertEqual(res, b"some test")
Пример #9
0
 def method(testcase):
     testcase.expectCommands(
         Expect("command").stdout("stdout").stderr("stderr"))
     d = utils.getProcessOutputAndValue("command", ())
     d.addCallback(testcase.assertEqual, ("stdout", 'stderr', 0))
     return d
Пример #10
0
 def method(testcase):
     testcase.expectCommands(Expect("command").stderr("some test"))
     d = utils.getProcessOutputAndValue("command", ())
     d.addCallback(self.assertEqual, ('', 'some test', 0))
     return d
Пример #11
0
 def method(testcase):
     testcase.expectCommands(Expect("command").exit(1))
     res = yield utils.getProcessOutputAndValue("command", ())
     self.assertEqual(res, (b'', b'', 1))
Пример #12
0
 def method(testcase):
     testcase.expectCommands(Expect("command").stderr(b"some test"))
     res = yield utils.getProcessOutputAndValue("command", ())
     self.assertEqual(res, (b'', b'some test', 0))
Пример #13
0
 def method(testcase):
     testcase.expectCommands(Expect("command", "arg"))
     yield utils.getProcessOutputAndValue("command", ("otherarg", ),
                                          path="/work")
     testcase.assertAllCommandsRan()
Пример #14
0
 def method(testcase):
     testcase.expectCommands(Expect("command2"))
     yield utils.getProcessOutputAndValue("command", ())
     testcase.assertAllCommandsRan()
Пример #15
0
 def method(testcase):
     testcase.expectCommands(Expect("command").stdout(b"stdout"))
     res = yield utils.getProcessOutput("command", ())
     testcase.assertEqual(res, b"stdout")
Пример #16
0
 def method(testcase):
     testcase.expectCommands(Expect("command").stderr("some test"))
     d = utils.getProcessOutput("command", (), errortoo=True)
     d.addCallback(testcase.assertEqual, "some test")
     return d
Пример #17
0
 def method(testcase):
     testcase.expectCommands(Expect("command").stdout("stdout"))
     d = utils.getProcessOutput("command", ())
     d.addCallback(testcase.assertEqual, "stdout")
     return d
Пример #18
0
 def method(testcase):
     testcase.expectCommands(
         Expect("command").stdout(b"stdout").stderr(b"stderr"))
     res = yield utils.getProcessOutputAndValue("command", ())
     testcase.assertEqual(res, (b"stdout", b'stderr', 0))
Пример #19
0
 def method(testcase):
     testcase.expectCommands(Expect("command"))
     testcase.addGetProcessOutputExpectEnv({'key': 'value'})
     d = utils.getProcessOutput("command", ())
     return d
Пример #20
0
 def method(testcase):
     testcase.expectCommands(Expect("command"))
     res = yield utils.getProcessOutput("command", ())
     self.assertEqual(res, b'')
     testcase.assertAllCommandsRan()
Пример #21
0
 def method(testcase):
     testcase.expectCommands(Expect("command", "arg"))
     d = utils.getProcessOutputAndValue("command", ("otherarg", ),
                                        path="/work")
     d.addCallback(lambda _: testcase.assertAllCommandsRan())
     return d
Пример #22
0
 def test_methodChaining(self):
     expect = Expect('command')
     self.assertEqual(expect, expect.exit(0))
     self.assertEqual(expect, expect.stdout("output"))
     self.assertEqual(expect, expect.stderr("error"))
Пример #23
0
 def method(testcase):
     testcase.expectCommands(Expect("command").exit(1))
     d = utils.getProcessOutputAndValue("command", ())
     d.addCallback(self.assertEqual, ('', '', 1))
     return d
Пример #24
0
 def method(testcase):
     testcase.expectCommands(Expect("command2"))
     d = utils.getProcessOutput("command", ())
     return d
Пример #25
0
 def test_methodChaining(self):
     expect = Expect('command')
     self.assertEqual(expect, expect.exit(0))
     self.assertEqual(expect, expect.stdout("output"))
     self.assertEqual(expect, expect.stderr("error"))
Пример #26
0
 def method(testcase):
     testcase.expectCommands(Expect("command", "arg").path("/home"))
     yield utils.getProcessOutput("command", ("otherarg", ))
     testcase.assertAllCommandsRan()