subprocess-util/test.py

26 lines
801 B
Python

from pathlib import Path
from subprocess_util import execute_print_capture
from subprocess_util_2 import execute_print_capture_bin
def test():
print("TEST ONE")
returncode, out, err = execute_print_capture(['ls', '-la'])
print()
returncode, out, err = execute_print_capture(['ls', '/foo/bar'])
print("TEST TWO-1")
execute_print_capture(['rm', '-rf', 'test/1', 'test/2', 'test/3'])
returncode = execute_print_capture_bin(['ls', '-la'], Path('test/1'))
print("TEST TWO-2")
returncode = execute_print_capture_bin(['ls', '/foo/bar'], Path('test/2'))
print("TEST TWO-3")
returncode = execute_print_capture_bin(['cat', 'subprocess_util.py'], Path('test/3'),
chunk_size=1024)
if __name__ == '__main__':
test()