Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
4a488ffd
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,发现更多精彩内容 >>
未验证
提交
4a488ffd
编写于
5月 22, 2019
作者:
J
Jan Richter
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'clebergnu/genio_cleanup'
Signed-off-by:
N
Jan Richter
<
jarichte@redhat.com
>
上级
60854dc1
403e3131
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
0 addition
and
58 deletion
+0
-58
avocado/core/test.py
avocado/core/test.py
+0
-3
avocado/utils/genio.py
avocado/utils/genio.py
+0
-55
未找到文件。
avocado/core/test.py
浏览文件 @
4a488ffd
...
@@ -359,9 +359,6 @@ class Test(unittest.TestCase, TestData):
...
@@ -359,9 +359,6 @@ class Test(unittest.TestCase, TestData):
"should never happen: %s"
"should never happen: %s"
%
logdir
)
%
logdir
)
self
.
__logdir
=
utils_path
.
init_dir
(
logdir
)
self
.
__logdir
=
utils_path
.
init_dir
(
logdir
)
# Replace '/' with '_' to avoid splitting name into multiple dirs
genio
.
set_log_file_dir
(
self
.
logdir
)
self
.
__logfile
=
os
.
path
.
join
(
self
.
logdir
,
'debug.log'
)
self
.
__logfile
=
os
.
path
.
join
(
self
.
logdir
,
'debug.log'
)
self
.
_ssh_logfile
=
os
.
path
.
join
(
self
.
logdir
,
'remote.log'
)
self
.
_ssh_logfile
=
os
.
path
.
join
(
self
.
logdir
,
'remote.log'
)
...
...
avocado/utils/genio.py
浏览文件 @
4a488ffd
...
@@ -18,72 +18,17 @@ Avocado generic IO related functions.
...
@@ -18,72 +18,17 @@ Avocado generic IO related functions.
import
logging
import
logging
import
os
import
os
import
time
import
re
import
re
from
.
import
path
as
utils_path
log
=
logging
.
getLogger
(
'avocado.test'
)
log
=
logging
.
getLogger
(
'avocado.test'
)
_open_log_files
=
{}
_log_file_dir
=
os
.
environ
.
get
(
'TMPDIR'
,
'/tmp'
)
class
GenIOError
(
Exception
):
class
GenIOError
(
Exception
):
"""
"""
Base Exception Class for all IO exceptions
Base Exception Class for all IO exceptions
"""
"""
def
log_line
(
filename
,
line
):
"""
Write a line to a file.
:param filename: Path of file to write to, either absolute or relative to
the dir set by set_log_file_dir().
:param line: Line to write.
"""
global
_open_log_files
,
_log_file_dir
# pylint: disable=W0603
path
=
utils_path
.
get_path
(
_log_file_dir
,
filename
)
if
path
not
in
_open_log_files
:
# First, let's close the log files opened in old directories
close_log_file
(
filename
)
# Then, let's open the new file
try
:
utils_path
.
init_dir
(
os
.
path
.
dirname
(
path
))
except
OSError
:
pass
_open_log_files
[
path
]
=
open
(
path
,
"w"
)
timestr
=
time
.
strftime
(
"%Y-%m-%d %H:%M:%S"
)
_open_log_files
[
path
].
write
(
"%s: %s
\n
"
%
(
timestr
,
line
))
_open_log_files
[
path
].
flush
()
def
set_log_file_dir
(
directory
):
"""
Set the base directory for log files created by log_line().
:param dir: Directory for log files.
"""
global
_log_file_dir
# pylint: disable=W0603
_log_file_dir
=
directory
def
close_log_file
(
filename
):
global
_open_log_files
,
_log_file_dir
# pylint: disable=W0603
remove
=
[]
for
k
in
_open_log_files
:
if
os
.
path
.
basename
(
k
)
==
filename
:
f
=
_open_log_files
[
k
]
f
.
close
()
remove
.
append
(
k
)
if
remove
:
for
key_to_remove
in
remove
:
_open_log_files
.
pop
(
key_to_remove
)
def
ask
(
question
,
auto
=
False
):
def
ask
(
question
,
auto
=
False
):
"""
"""
Prompt the user with a (y/n) question.
Prompt the user with a (y/n) question.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录