예제 #1
0
파일: test_shell.py 프로젝트: kostyll/pakit
 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
예제 #2
0
파일: test_shell.py 프로젝트: kostyll/pakit
 def get_hash(target):
     """
     Required because with now forces right commit
     """
     cmd = Command("hg identify", target)
     cmd.wait()
     return cmd.output()[0].split()[0]
예제 #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
예제 #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]
예제 #5
0
파일: test_shell.py 프로젝트: kostyll/pakit
    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")
예제 #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')
예제 #7
0
파일: test_shell.py 프로젝트: kostyll/pakit
 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!"]
예제 #8
0
파일: test_shell.py 프로젝트: kostyll/pakit
 def test_output(self):
     cmd = Command('echo "Hello py.test"')
     cmd.wait()
     lines = cmd.output()
     assert lines == ["Hello py.test"]