Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
f51d808f
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f51d808f
编写于
4月 15, 2015
作者:
L
Lucas Meneghel Rodrigues
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #548 from ldoktor/genio.2
avocado: Exception handling bugfixes [v2]
上级
ac425613
0783738a
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
44 addition
and
14 deletion
+44
-14
avocado/aexpect.py
avocado/aexpect.py
+1
-1
avocado/core/output.py
avocado/core/output.py
+3
-3
avocado/gdb.py
avocado/gdb.py
+2
-2
avocado/loader.py
avocado/loader.py
+18
-3
avocado/plugins/test_list.py
avocado/plugins/test_list.py
+3
-1
avocado/restclient/connection.py
avocado/restclient/connection.py
+1
-1
avocado/settings.py
avocado/settings.py
+1
-1
avocado/utils/genio.py
avocado/utils/genio.py
+1
-1
avocado/utils/process.py
avocado/utils/process.py
+1
-1
examples/tests/failtest_ugly.py
examples/tests/failtest_ugly.py
+13
-0
未找到文件。
avocado/aexpect.py
浏览文件 @
f51d808f
...
...
@@ -983,7 +983,7 @@ class Tail(Spawn):
if
_thread_kill_requested
:
try
:
os
.
close
(
fd
)
except
:
except
Exception
:
pass
return
try
:
...
...
avocado/core/output.py
浏览文件 @
f51d808f
...
...
@@ -54,7 +54,7 @@ class ProgressStreamHandler(logging.StreamHandler):
self
.
flush
()
except
(
KeyboardInterrupt
,
SystemExit
):
raise
except
:
except
Exception
:
self
.
handleError
(
record
)
...
...
@@ -89,13 +89,13 @@ class Paginator(object):
def
close
(
self
):
try
:
self
.
pipe
.
close
()
except
:
except
Exception
:
pass
def
write
(
self
,
msg
):
try
:
self
.
pipe
.
write
(
msg
)
except
:
except
Exception
:
pass
...
...
avocado/gdb.py
浏览文件 @
f51d808f
...
...
@@ -421,7 +421,7 @@ class GDB(object):
# generated by the application being run inside the debugger
try
:
parsed_response
=
parse_mi
(
line
)
except
:
except
Exception
:
cmd
.
application_output
.
append
(
line
)
continue
...
...
@@ -660,7 +660,7 @@ class GDBServer(object):
c
.
connect
(
self
.
port
)
connection_ok
=
True
break
except
:
except
Exception
:
time
.
sleep
(
0.1
)
c
.
disconnect
()
c
.
exit
()
...
...
avocado/loader.py
浏览文件 @
f51d808f
...
...
@@ -17,16 +17,21 @@
Test loader module.
"""
import
imp
import
inspect
import
os
import
re
import
sys
import
imp
import
inspect
from
avocado
import
test
from
avocado.core
import
data_dir
from
avocado.utils
import
path
try
:
import
cStringIO
as
StringIO
except
ImportError
:
import
StringIO
class
_DebugJob
(
object
):
...
...
@@ -99,7 +104,11 @@ class TestLoader(object):
'base_logdir'
:
self
.
job
.
logdir
,
'params'
:
params
,
'job'
:
self
.
job
}
stdin
,
stdout
,
stderr
=
sys
.
stdin
,
sys
.
stdout
,
sys
.
stderr
try
:
sys
.
stdin
=
None
sys
.
stdout
=
StringIO
.
StringIO
()
sys
.
stderr
=
StringIO
.
StringIO
()
f
,
p
,
d
=
imp
.
find_module
(
module_name
,
[
test_module_dir
])
test_module
=
imp
.
load_module
(
module_name
,
f
,
p
,
d
)
f
.
close
()
...
...
@@ -135,7 +144,9 @@ class TestLoader(object):
# Since a lot of things can happen here, the broad exception is
# justified. The user will get it unadulterated anyway, and avocado
# will not crash.
except
Exception
,
details
:
except
BaseException
,
details
:
# Ugly python files can raise any exc
if
isinstance
(
details
,
KeyboardInterrupt
):
raise
# Don't ignore ctrl+c
if
os
.
access
(
test_path
,
os
.
X_OK
):
# Module can't be imported, and it's executable. Let's try to
# execute it.
...
...
@@ -159,6 +170,10 @@ class TestLoader(object):
params
[
'exception'
]
=
details
else
:
test_class
=
test
.
NotATest
finally
:
sys
.
stdin
=
stdin
sys
.
stdout
=
stdout
sys
.
stderr
=
stderr
sys
.
path
.
pop
(
sys
.
path
.
index
(
test_module_dir
))
...
...
avocado/plugins/test_list.py
浏览文件 @
f51d808f
...
...
@@ -172,5 +172,7 @@ class TestList(plugin.Plugin):
self
.
view
.
notify
(
event
=
'error'
,
msg
=
msg
)
else
:
sys
.
stderr
.
write
(
msg
)
self
.
view
.
cleanup
()
finally
:
if
self
.
view
:
self
.
view
.
cleanup
()
sys
.
exit
(
rc
)
avocado/restclient/connection.py
浏览文件 @
f51d808f
...
...
@@ -188,7 +188,7 @@ class Connection(object):
"""
try
:
self
.
request
(
'version'
)
except
:
except
Exception
:
return
False
return
True
...
...
avocado/settings.py
浏览文件 @
f51d808f
...
...
@@ -89,7 +89,7 @@ def convert_value_type(value, value_type):
# strip off leading and trailing white space
try
:
sval
=
value
.
strip
()
except
:
except
Exception
:
sval
=
value
if
isinstance
(
value_type
,
str
):
...
...
avocado/utils/genio.py
浏览文件 @
f51d808f
...
...
@@ -147,7 +147,7 @@ def read_all_lines(filename):
try
:
with
open
(
filename
,
'r'
)
as
file_obj
:
contents
=
[
line
.
rstrip
(
'
\n
'
)
for
line
in
file_obj
.
readlines
()]
except
:
except
Exception
:
pass
return
contents
...
...
avocado/utils/process.py
浏览文件 @
f51d808f
...
...
@@ -687,7 +687,7 @@ class GDBSubProcess(object):
try
:
msgs
=
self
.
gdb
.
read_until_break
()
messages
+=
msgs
except
:
except
Exception
:
pass
try
:
...
...
examples/tests/failtest_ugly.py
0 → 100644
浏览文件 @
f51d808f
"""
Please don't get inspired by this ugly code
"""
import
sys
sys
.
stdout
.
write
(
"Direct output to stdout
\n
"
)
sys
.
stderr
.
write
(
"Direct output to stderr
\n
"
)
raw_input
(
"I really want some input on each import"
)
sys
.
stdin
=
'This is my __COOL__ stdin'
sys
.
stdout
=
'my stdout'
sys
.
stderr
=
'my stderr'
sys
.
exit
(
-
1
)
# Exit even on import
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录