Ejemplo n.º 1
0
 def test_env_override(self):
     old_environ = os.environ.copy()
     os.environ["HELLO"] = "bad"
     cmd = Command(["env"], env={"HELLO": "pakit"})
     cmd.wait()
     "HELLO=pakit" in cmd.output()
     os.environ = old_environ
Ejemplo n.º 2
0
 def get_hash(target):
     """
     Required because with now forces right commit
     """
     cmd = Command("hg identify", target)
     cmd.wait()
     return cmd.output()[0].split()[0]
Ejemplo n.º 3
0
 def test_env_override(self):
     old_environ = os.environ.copy()
     os.environ['HELLO'] = 'bad'
     cmd = Command(['env'], env={'HELLO': 'pakit'})
     cmd.wait()
     'HELLO=pakit' in cmd.output()
     os.environ = old_environ
Ejemplo n.º 4
0
 def get_hash(target):
     """
     Required because with now forces right commit
     """
     cmd = Command('git log -1 ', target)
     cmd.wait()
     return cmd.output()[0].split()[-1]
Ejemplo n.º 5
0
    def test_command_dir(self):
        try:
            os.makedirs("dummy")
            with open("dummy/hello", "wb") as fout:
                fout.write("this is a sample line".encode())

            cmd = Command("ls", os.path.abspath("./dummy"))
            cmd.wait()

            assert cmd.rcode == 0
            assert cmd.output() == ["hello"]
        finally:
            tc.delete_it("dummy")
Ejemplo n.º 6
0
    def test_command_dir(self):
        try:
            os.makedirs('dummy')
            with open('dummy/hello', 'wb') as fout:
                fout.write('this is a sample line'.encode())

            cmd = Command('ls', os.path.abspath('./dummy'))
            cmd.wait()

            assert cmd.rcode == 0
            assert cmd.output() == ['hello']
        finally:
            tc.delete_it('dummy')
Ejemplo n.º 7
0
 def test_prev_cmd_stdin(self):
     cmd = Command('echo -e "Hello\nGoodbye!"')
     cmd.wait()
     cmd2 = Command('grep "ood"', prev_cmd=cmd)
     cmd2.wait()
     assert cmd2.output() == ["Goodbye!"]
Ejemplo n.º 8
0
 def test_output(self):
     cmd = Command('echo "Hello py.test"')
     cmd.wait()
     lines = cmd.output()
     assert lines == ["Hello py.test"]