2017-11-06 15:41:51 +00:00
|
|
|
from pydu.compat import text_type
|
2017-11-07 00:29:17 +00:00
|
|
|
from pydu.string import safeunicode
|
|
|
|
from pydu.cmd import execute, cmdline_argv
|
|
|
|
|
|
|
|
|
|
|
|
def test_execute():
|
|
|
|
retcode, output = execute('echo hello')
|
|
|
|
assert retcode == 0
|
|
|
|
assert safeunicode(output).rstrip('\r\n') == 'hello'
|
|
|
|
|
|
|
|
p = execute('echo hello', wait=False)
|
|
|
|
assert p.wait() == 0
|
2017-11-06 15:41:51 +00:00
|
|
|
|
|
|
|
|
2017-11-07 00:15:05 +00:00
|
|
|
def test_cmdline_argv():
|
|
|
|
argv = cmdline_argv()
|
2017-11-06 15:41:51 +00:00
|
|
|
for s in argv[1:]:
|
|
|
|
assert isinstance(s, text_type)
|