Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
d0fb1f15
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d0fb1f15
编写于
9月 17, 2018
作者:
C
Cleber Rosa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'cacarrara/enables-pylint-w0702'
Signed-off-by:
N
Cleber Rosa
<
crosa@redhat.com
>
上级
fb605738
1b2a74eb
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
29 addition
and
28 deletion
+29
-28
avocado/core/loader.py
avocado/core/loader.py
+1
-1
avocado/core/test.py
avocado/core/test.py
+2
-2
avocado/plugins/teststmpdir.py
avocado/plugins/teststmpdir.py
+1
-1
avocado/utils/asset.py
avocado/utils/asset.py
+2
-2
avocado/utils/filelock.py
avocado/utils/filelock.py
+3
-3
examples/plugins/job-pre-post/mail/avocado_job_mail.py
examples/plugins/job-pre-post/mail/avocado_job_mail.py
+1
-1
examples/tests/test_env.py
examples/tests/test_env.py
+1
-1
scripts/avocado
scripts/avocado
+12
-12
selftests/checkall
selftests/checkall
+2
-1
selftests/doc/test_doc_build.py
selftests/doc/test_doc_build.py
+1
-1
selftests/functional/test_utils.py
selftests/functional/test_utils.py
+1
-1
selftests/unit/test_utils_cloudinit.py
selftests/unit/test_utils_cloudinit.py
+1
-1
selftests/unit/test_xunit.py
selftests/unit/test_xunit.py
+1
-1
未找到文件。
avocado/core/loader.py
浏览文件 @
d0fb1f15
...
...
@@ -339,7 +339,7 @@ class TestLoaderProxy(object):
sys
.
path
.
insert
(
0
,
test_module_dir
)
f
,
p
,
d
=
imp
.
find_module
(
module_name
,
[
test_module_dir
])
test_module
=
imp
.
load_module
(
module_name
,
f
,
p
,
d
)
except
:
except
:
# pylint: disable=W0702
# On load_module exception we fake the test class and pass
# the exc_info as parameter to be logged.
test_parameters
[
'methodName'
]
=
'test'
...
...
avocado/core/test.py
浏览文件 @
d0fb1f15
...
...
@@ -827,7 +827,7 @@ class Test(unittest.TestCase, TestData):
except
exceptions
.
TestCancel
as
details
:
stacktrace
.
log_exc_info
(
sys
.
exc_info
(),
logger
=
LOG_JOB
)
raise
except
:
# Old-style exceptions are not inherited from Exception()
except
:
# Old-style exceptions are not inherited from Exception()
pylint: disable=W0702
stacktrace
.
log_exc_info
(
sys
.
exc_info
(),
logger
=
LOG_JOB
)
details
=
sys
.
exc_info
()[
1
]
if
not
isinstance
(
details
,
Exception
):
# Avoid passing nasty exc
...
...
@@ -852,7 +852,7 @@ class Test(unittest.TestCase, TestData):
except
exceptions
.
TestCancel
as
details
:
stacktrace
.
log_exc_info
(
sys
.
exc_info
(),
logger
=
LOG_JOB
)
raise
except
:
# avoid old-style exception failures
except
:
# avoid old-style exception failures
pylint: disable=W0702
stacktrace
.
log_exc_info
(
sys
.
exc_info
(),
logger
=
LOG_JOB
)
details
=
sys
.
exc_info
()[
1
]
cleanup_exception
=
exceptions
.
TestSetupFail
(
details
)
...
...
avocado/plugins/teststmpdir.py
浏览文件 @
d0fb1f15
...
...
@@ -43,5 +43,5 @@ class TestsTmpDir(JobPre, JobPost):
try
:
shutil
.
rmtree
(
self
.
_dirname
)
del
os
.
environ
[
self
.
_varname
]
except
:
except
Exception
:
pass
avocado/utils/asset.py
浏览文件 @
d0fb1f15
...
...
@@ -157,7 +157,7 @@ class Asset(object):
with
FileLock
(
asset_file
,
1
):
if
self
.
_verify
(
asset_file
):
return
asset_file
except
:
except
Exception
:
exc_type
,
exc_value
=
sys
.
exc_info
()[:
2
]
log
.
error
(
'%s: %s'
,
exc_type
.
__name__
,
exc_value
)
...
...
@@ -188,7 +188,7 @@ class Asset(object):
try
:
if
fetch
(
urlobj
,
asset_file
):
return
asset_file
except
:
except
Exception
:
exc_type
,
exc_value
=
sys
.
exc_info
()[:
2
]
log
.
error
(
'%s: %s'
,
exc_type
.
__name__
,
exc_value
)
...
...
avocado/utils/filelock.py
浏览文件 @
d0fb1f15
...
...
@@ -56,7 +56,7 @@ class FileLock(object):
os
.
close
(
fd
)
self
.
locked
=
True
return
self
except
:
except
Exception
:
try
:
# Read the file to realize what's happening.
with
open
(
self
.
filename
,
'r'
)
as
f
:
...
...
@@ -90,7 +90,7 @@ class FileLock(object):
except
:
raise
LockFailed
(
'Not able to lock.'
)
except
:
except
Exception
:
# If we cannot read the lock file, let's just
# go on. Maybe in next iteration (if we have time)
# we have a better luck.
...
...
@@ -111,5 +111,5 @@ class FileLock(object):
try
:
os
.
remove
(
self
.
filename
)
self
.
locked
=
False
except
:
except
Exception
:
pass
examples/plugins/job-pre-post/mail/avocado_job_mail.py
浏览文件 @
d0fb1f15
...
...
@@ -44,7 +44,7 @@ class Mail(JobPre, JobPost):
smtp
=
smtplib
.
SMTP
(
self
.
server
)
smtp
.
sendmail
(
self
.
sender
,
[
self
.
rcpt
],
msg
.
as_string
())
smtp
.
quit
()
except
:
except
Exception
:
LOG_UI
.
error
(
"Failure to send email notification: "
"please check your mail configuration"
)
...
...
examples/tests/test_env.py
浏览文件 @
d0fb1f15
...
...
@@ -17,7 +17,7 @@ class Env(Test):
def
get_proc_content
(
rel_path
):
try
:
return
genio
.
read_file
(
os
.
path
.
join
(
p_dir
,
rel_path
)).
strip
()
except
:
except
OSError
:
return
"<NOT AVAILABLE>"
self
.
log
.
debug
(
'Process ID: %s'
,
pid
)
...
...
scripts/avocado
浏览文件 @
d0fb1f15
...
...
@@ -17,9 +17,12 @@
import
sys
try
:
import
os
import
time
import
tempfile
import
traceback
except
:
from
avocado.core
import
data_dir
except
ImportError
:
sys
.
stderr
.
write
(
"Unable to import basic python libraries, please "
"reinstall avocado and dependencies.
\n
"
)
# This exit code is replicated from avocado/core/exit_codes.py and not
...
...
@@ -27,6 +30,12 @@ except:
sys
.
exit
(
-
1
)
def
get_crash_dir
():
crash_dir_path
=
os
.
path
.
join
(
data_dir
.
get_data_dir
(),
"crashes"
)
os
.
makedirs
(
crash_dir_path
)
return
crash_dir_path
def
handle_exception
(
*
exc_info
):
# Print traceback if AVOCADO_LOG_DEBUG environment variable is set
msg
=
"Avocado crashed:
\n
"
+
""
.
join
(
traceback
.
format_exception
(
*
exc_info
))
...
...
@@ -34,18 +43,9 @@ def handle_exception(*exc_info):
if
os
.
environ
.
get
(
"AVOCADO_LOG_DEBUG"
):
os
.
write
(
2
,
msg
.
encode
(
'utf-8'
))
# Store traceback in data_dir or TMPDIR
crash_dir
=
None
prefix
=
"avocado-traceback-"
try
:
import
time
prefix
+=
time
.
strftime
(
"%F_%T"
)
+
"-"
from
avocado.core
import
data_dir
# pylint: disable=E0611
_crash_dir
=
os
.
path
.
join
(
data_dir
.
get_data_dir
(),
"crashes"
)
os
.
makedirs
(
_crash_dir
)
crash_dir
=
_crash_dir
except
:
pass
tmp
,
name
=
tempfile
.
mkstemp
(
".log"
,
prefix
,
crash_dir
)
tmp
,
name
=
tempfile
.
mkstemp
(
".log"
,
prefix
,
get_crash_dir
())
os
.
write
(
tmp
,
msg
.
encode
(
'utf-8'
))
os
.
close
(
tmp
)
# Print friendly message in console-like output
...
...
selftests/checkall
浏览文件 @
d0fb1f15
...
...
@@ -169,7 +169,8 @@ results_dir_content() {
[
"
$SKIP_RESULTSDIR_CHECK
"
]
||
RESULTS_DIR_CONTENT
=
"
$(
ls
$RESULTS_DIR
2> /dev/null
)
"
LINT_CMD
=
"inspekt lint --exclude=.git"
PYLINT_ENABLE
=
"--enable R0401,W0101,W0102,W0104,W0105,W0106,W0107,W0108,W0109,W0111,W0120,W0122,W0123,W0124,W0125,W0150,W0199,W0211,W0222,W0223,W0232,W0233,W0301,W0311,W0312,W0401,W0404,W0406,W0410,W0601,W0602,W0603,W0604,W0611,W0612,W0613,W0614,W0621,W0622,W0623,W0631,W0640,W0705,W0711,W1201,W1202,W1300,W1301,W1302,W1303,W1304,W1305,W1306,W1307,W1401,W1402,W1501,W1503,W1645"
PYLINT_ENABLE
=
"--enable R0401,W0101,W0102,W0104,W0105,W0106,W0107,W0108,W0109,W0111,W0120,W0122,W0123,W0124,W0125,W0150,W0199,W0211,W0222,W0223,W0232,W0233,W0301,W0311,W0312,W0401,W0404,W0406,W0410,W0601,W0602,W0603,W0604,W0611,W0612,W0613,W0614,W0621,W0622,W0623,W0631,W0640,W0702,W0705,W0711,W1201,W1202,W1300,W1301,W1302,W1303,W1304,W1305,W1306,W1307,W1401,W1402,W1501,W1503,W1645"
if
[
"
$AVOCADO_PARALLEL_LINT
"
]
;
then
LINT_CMD
=
"
$LINT_CMD
--parallel=
$AVOCADO_PARALLEL_LINT
"
fi
...
...
selftests/doc/test_doc_build.py
浏览文件 @
d0fb1f15
...
...
@@ -29,7 +29,7 @@ def has_no_external_connectivity():
try
:
urllib
.
urlopen
(
'http://docs.python.org/objects.inv'
)
return
False
except
:
except
Exception
:
return
True
...
...
selftests/functional/test_utils.py
浏览文件 @
d0fb1f15
...
...
@@ -186,7 +186,7 @@ class FileLockTest(unittest.TestCase):
args
=
[(
self
.
tmpdir
,
players
,
timeout
)]
*
players
try
:
pool
.
map
(
file_lock_action
,
args
)
except
:
except
Exception
:
msg
=
'Failed to run FileLock with %s players:
\n
%s'
msg
%=
(
players
,
prepare_exc_info
(
sys
.
exc_info
()))
self
.
fail
(
msg
)
...
...
selftests/unit/test_utils_cloudinit.py
浏览文件 @
d0fb1f15
...
...
@@ -59,7 +59,7 @@ class PhoneHome(unittest.TestCase):
conn
.
request
(
'POST'
,
url
)
try
:
conn
.
getresponse
()
except
:
except
Exception
:
pass
finally
:
conn
.
close
()
...
...
selftests/unit/test_xunit.py
浏览文件 @
d0fb1f15
...
...
@@ -7,7 +7,7 @@ from xml.dom import minidom
try
:
from
io
import
BytesIO
except
:
except
ImportError
:
from
BytesIO
import
BytesIO
try
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录