Example #1
0
 def testStdin(self):
     """Will write to subprocess.stdin."""
     with self.assertRaises(subprocess.CalledProcessError) as cpe:
         bootstrap.call(['/bin/bash'], stdin='exit 92')
     self.assertEquals(92, cpe.exception.returncode)
Example #2
0
    def testCheckTrue(self):
        """Raise on non-zero exit codes if check is set."""
        with self.assertRaises(subprocess.CalledProcessError) as cpe:
            bootstrap.call(FAIL, check=True)

        bootstrap.call(PASS, check=True)
Example #3
0
 def testCheckFalse(self):
     """Never raise when check is not set."""
     bootstrap.call(FAIL, check=False)
     bootstrap.call(PASS, check=False)
Example #4
0
 def testOutput(self):
     """Output is returned when requested."""
     cmd = ['/bin/bash', '-c', 'echo hello world']
     self.assertEquals('hello world\n', bootstrap.call(cmd, output=True))
    def testCheckTrue(self):
        """Raise on non-zero exit codes if check is set."""
        with self.assertRaises(subprocess.CalledProcessError) as cpe:
            bootstrap.call(FAIL, check=True)

        bootstrap.call(PASS, check=True)
Example #6
0
    def testCheckDefault(self):
        """Default to check=True."""
        with self.assertRaises(subprocess.CalledProcessError) as cpe:
            bootstrap.call(FAIL)

        bootstrap.call(PASS)
 def testStdin(self):
     """Will write to subprocess.stdin."""
     with self.assertRaises(subprocess.CalledProcessError) as cpe:
         bootstrap.call(['/bin/bash'], stdin='exit 92')
     self.assertEquals(92, cpe.exception.returncode)
Example #8
0
 def testZombie(self):
     with self.assertRaises(subprocess.CalledProcessError) as cpe:
         # make a zombie
         bootstrap.call(['/bin/bash', '-c', 'A=$BASHPID && ( kill -STOP $A ) & exit 1'])
 def testOutput(self):
     """Output is returned when requested."""
     cmd = ['/bin/bash', '-c', 'echo hello world']
     self.assertEquals(
         'hello world\n', bootstrap.call(cmd, output=True))
 def testCheckFalse(self):
     """Never raise when check is not set."""
     bootstrap.call(FAIL, check=False)
     bootstrap.call(PASS, check=False)
    def testCheckDefault(self):
        """Default to check=True."""
        with self.assertRaises(subprocess.CalledProcessError) as cpe:
            bootstrap.call(FAIL)

        bootstrap.call(PASS)