예제 #1
0
 def test_error_output(self):
     '''Test error output from command'''
     cmd = BuildCommand('/bin/bash -c "echo -n FOOBAR 1>&2"')
     with cmd:
         cmd.run()
     self.assertEqual(cmd.output, "")
     self.assertEqual(cmd.error, "FOOBAR")
예제 #2
0
 def test_error_output(self):
     '''Test error output from command'''
     cmd = BuildCommand('/bin/bash -c "echo -n FOOBAR 1>&2"')
     with cmd:
         cmd.run()
     self.assertEqual(cmd.output, "")
     self.assertEqual(cmd.error, "FOOBAR")
예제 #3
0
 def test_missing_command(self):
     '''Test missing command'''
     path = os.path.join('non-existant', str(uuid.uuid4()))
     self.assertFalse(os.path.exists(path))
     cmd = BuildCommand('/non-existant/foobar')
     with cmd:
         cmd.run()
     missing_re = re.compile(r'(?:No such file or directory|not found)')
     self.assertRegexpMatches(cmd.error, missing_re)
예제 #4
0
 def test_missing_command(self):
     '''Test missing command'''
     path = os.path.join('non-existant', str(uuid.uuid4()))
     self.assertFalse(os.path.exists(path))
     cmd = BuildCommand('/non-existant/foobar')
     with cmd:
         cmd.run()
     missing_re = re.compile(r'(?:No such file or directory|not found)')
     self.assertRegexpMatches(cmd.error, missing_re)
예제 #5
0
    def test_result(self):
        '''Test result of output using unix true/false commands'''
        cmd = BuildCommand('true')
        with cmd:
            cmd.run()
        self.assertTrue(cmd.successful())

        cmd = BuildCommand('false')
        with cmd:
            cmd.run()
        self.assertTrue(cmd.failed())
예제 #6
0
    def test_result(self):
        '''Test result of output using unix true/false commands'''
        cmd = BuildCommand('true')
        with cmd:
            cmd.run()
        self.assertTrue(cmd.successful())

        cmd = BuildCommand('false')
        with cmd:
            cmd.run()
        self.assertTrue(cmd.failed())
예제 #7
0
 def test_output(self):
     '''Test output command'''
     cmd = BuildCommand('/bin/bash -c "echo -n FOOBAR"')
     with cmd:
         cmd.run()
     self.assertEqual(cmd.output, "FOOBAR")
예제 #8
0
 def test_input(self):
     '''Test input to command'''
     cmd = BuildCommand('/bin/cat')
     with cmd:
         cmd.run(cmd_input="FOOBAR")
     self.assertEqual(cmd.output, "FOOBAR")
예제 #9
0
 def test_output(self):
     '''Test output command'''
     cmd = BuildCommand('/bin/bash -c "echo -n FOOBAR"')
     with cmd:
         cmd.run()
     self.assertEqual(cmd.output, "FOOBAR")
예제 #10
0
 def test_input(self):
     '''Test input to command'''
     cmd = BuildCommand('/bin/cat')
     with cmd:
         cmd.run(cmd_input="FOOBAR")
     self.assertEqual(cmd.output, "FOOBAR")
예제 #11
0
 def test_command_env(self):
     '''Test build command env vars'''
     env = {'FOOBAR': 'foobar', 'PATH': 'foobar'}
     cmd = BuildCommand('echo', environment=env)
     for key in env.keys():
         self.assertEqual(cmd.environment[key], env[key])