Skip to content

Commit fee924d

Browse files
committed
更新命令回显
1 parent 49dc58a commit fee924d

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

test/test_system.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77

88
import os
9+
import commands
910

1011

1112
def test_memory_usage():
@@ -42,7 +43,8 @@ def test_get_local_ip():
4243
"""
4344
获取本地ip地址
4445
"""
45-
cmd = "LC_ALL=C ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'"
46+
# cmd = "LC_ALL=C ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'"
47+
cmd = "ifconfig"
4648
print cmd
4749
# result = os.system(cmd)
4850
result = os.popen(cmd).read()
@@ -53,9 +55,19 @@ def test_get_local_ip():
5355
return ip_list
5456

5557

58+
def test_commands():
59+
"""
60+
获取状态和回显
61+
:return:
62+
"""
63+
status, output = commands.getstatusoutput('ifconfig')
64+
print status, output
65+
66+
5667
if __name__ == '__main__':
5768
# test_memory_usage()
58-
test_get_local_ip()
69+
# test_get_local_ip()
70+
test_commands()
5971

6072
"""
6173
测试结果:

0 commit comments

Comments
 (0)