Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1c7f5013
提交
1c7f5013
authored
10月 09, 2008
作者:
Olivier Breuleux
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
no more need for scripts/test
上级
11faef91
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
0 行增加
和
108 行删除
+0
-108
test.py
scripts/test.py
+0
-108
没有找到文件。
scripts/test.py
deleted
100644 → 0
浏览文件 @
11faef91
import
unittest
,
os
,
sys
,
traceback
,
commands
theano_path
=
os
.
path
.
realpath
(
"
%
s/.."
%
sys
.
path
[
0
])
sys
.
path
[
0
:
0
]
=
[
theano_path
]
def
test_module
(
module_path
,
debugmode
=
False
):
files
=
commands
.
getoutput
(
"find
%
s -name test_*.py"
%
module_path
)
suite
=
None
tocut
=
len
(
"/"
.
join
(
module_path
.
split
(
"/"
)[:
-
1
]))
+
1
for
file
in
files
.
split
(
"
\n
"
):
file
=
file
[
tocut
:]
try
:
module
=
__import__
(
file
[:
-
3
])
except
Exception
,
e
:
print
>>
sys
.
stderr
,
"===================================================="
print
>>
sys
.
stderr
,
"Failed to load
%
s"
%
file
print
>>
sys
.
stderr
,
"===================================================="
traceback
.
print_exc
()
print
>>
sys
.
stderr
,
"===================================================="
continue
tests
=
unittest
.
TestLoader
()
.
loadTestsFromModule
(
module
)
if
tests
.
countTestCases
()
>
0
:
print
>>
sys
.
stderr
,
'Testing'
,
file
if
suite
is
None
:
suite
=
tests
else
:
suite
.
addTests
(
tests
)
if
suite
is
None
:
return
if
debugmode
:
suite
.
debug
()
else
:
unittest
.
TextTestRunner
(
verbosity
=
1
)
.
run
(
suite
)
def
py_test
(
module_path
):
py
.
test
.
cmdline
.
main
([
module_path
])
def
nopy_test
(
module_path
):
print
>>
sys
.
stderr
,
"py.test is not installed!"
print
>>
sys
.
stderr
,
" easy_install py"
print
>>
sys
.
stderr
,
"or if you are installing locally"
print
>>
sys
.
stderr
,
" easy_install --prefix=/some/local/dir py"
return
None
files
=
commands
.
getoutput
(
"find
%
s -name test_*.py"
%
module_path
)
suite
=
None
tocut
=
len
(
"/"
.
join
(
module_path
.
split
(
"/"
)[:
-
1
]))
+
1
for
file
in
files
.
split
(
"
\n
"
):
file
=
file
[
tocut
:]
try
:
module
=
__import__
(
file
[:
-
3
])
except
Exception
,
e
:
print
>>
sys
.
stderr
,
"===================================================="
print
>>
sys
.
stderr
,
"Failed to load
%
s"
%
file
print
>>
sys
.
stderr
,
"===================================================="
traceback
.
print_exc
()
print
>>
sys
.
stderr
,
"===================================================="
continue
for
method
in
dir
(
module
):
if
method
.
startswith
(
"test_"
):
method
=
getattr
(
module
,
method
)
try
:
r
=
method
()
except
Exception
,
e
:
print
>>
sys
.
stderr
,
"===================================================="
print
>>
sys
.
stderr
,
"Exception in
%
s.
%
s"
%
(
file
,
method
.
__name__
)
print
>>
sys
.
stderr
,
"===================================================="
traceback
.
print_exc
()
print
>>
sys
.
stderr
,
"===================================================="
if
hasattr
(
r
,
'next'
):
for
fargs
in
r
:
try
:
fargs
[
0
](
*
fargs
[
1
:])
except
Exception
,
e
:
print
>>
sys
.
stderr
,
"===================================================="
print
>>
sys
.
stderr
,
"Exception in
%
s.
%
s,
%
s
%
s"
%
(
file
,
method
.
__name__
,
fargs
[
0
],
fargs
[
1
:])
print
>>
sys
.
stderr
,
"===================================================="
traceback
.
print_exc
()
print
>>
sys
.
stderr
,
"===================================================="
if
__name__
==
'__main__'
:
def
printUsage
():
print
>>
sys
.
stderr
,
"Bad argument: "
,
sys
.
argv
print
>>
sys
.
stderr
,
"only --debug is supported"
sys
.
exit
(
1
)
debugparam
=
""
if
len
(
sys
.
argv
)
==
2
:
if
sys
.
argv
[
1
]
==
"--debug"
:
debugparam
=
"--debug"
sys
.
argv
.
remove
(
debugparam
)
else
:
printUsage
()
elif
len
(
sys
.
argv
)
>
2
:
printUsage
()
mname
=
os
.
path
.
join
(
theano_path
,
"theano"
)
test_module
(
mname
)
try
:
import
py.test
py_test
(
mname
)
except
ImportError
:
nopy_test
(
mname
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论