subprocess-util/test.py

26 lines
801 B
Python
Raw Normal View History

2023-01-10 17:24:35 +01:00
from pathlib import Path
2023-01-10 15:42:33 +01:00
from subprocess_util import execute_print_capture
2023-01-10 17:24:35 +01:00
from subprocess_util_2 import execute_print_capture_bin
2023-01-10 15:42:33 +01:00
def test():
2023-01-10 17:24:35 +01:00
print("TEST ONE")
2023-01-10 15:42:33 +01:00
returncode, out, err = execute_print_capture(['ls', '-la'])
print()
returncode, out, err = execute_print_capture(['ls', '/foo/bar'])
2023-01-10 17:24:35 +01:00
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)
2023-01-10 15:42:33 +01:00
if __name__ == '__main__':
test()