Esempio n. 1
0
def test_run_chained_cmd(sleep_cmd):
    out = ProgressOutputPipe()
    commander = Commander(out)

    commander.run_chained_commands([([
        "sh", "-c",
        "for x in {1..5} a b c d e; do echo $x; %s done" % sleep_cmd
    ], []), (["grep", "-e", "\\d"], [])])
    assert len(out.stdout) == 5
    for i in range(1, 5):
        assert i == int(out.stdout[i - 1])
Esempio n. 2
0
 def test_output_from_chained_command(self):
   out = CommandOutputPipeBase(False)
   commander = Commander(out)
   assert 0 == commander.run_chained_commands([(["echo", "hello world"], []), (["grep", "hello"], [])])
   assert out.stdout[0] == "hello world\n"
Esempio n. 3
0
 def test_longer_chained_command(self):
   commander = Commander()
   assert 0 == commander.run_chained_commands([(["echo", "hello world"], []), (["sed", "s/hello/mrcat/g"], []), (["sed", "s/mrcat/auohetn/g"], []), (["grep", "auohetn"], [])])
Esempio n. 4
0
 def test_failing_chained_command(self):
   commander = Commander()
   assert 1 == commander.run_chained_commands([(["echo", "hello world"], []), (["grep", "auohetn"], [])])
Esempio n. 5
0
 def test_simple_chained_command(self):
   commander = Commander()
   assert 0 == commander.run_chained_commands([(["echo", "hello world"], []), (["grep", "hello"], [])])