提交 a9f04767 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

fixed tests

上级 ff223c73
import unittest, os, sys, traceback
def test_root_dir(debugmode=False):
import unittest, os, sys, traceback, commands
def test_module(module_path, debugmode = False):
files = commands.getoutput("find %s -name test_*.py" % module_path)
suite = None
filenames = os.listdir('.')
for filename in filenames:
if filename[-3:] == '.py' and filename[0:5] == '_test':
#print >>sys.stderr, 'Loading', modname
modname = filename[0:-3]
try:
module = __import__(modname)
except Exception, e:
print >>sys.stderr, "===================================================="
print >>sys.stderr, "Failed to load %s.py" % modname
print >>sys.stderr, "===================================================="
traceback.print_exc()
print >>sys.stderr, "===================================================="
continue
tests = unittest.TestLoader().loadTestsFromModule(module)
if tests.countTestCases() > 0:
print >>sys.stderr, 'Testing', modname
if suite is None:
suite = tests
else:
suite.addTests(tests)
for file in files.split("\n"):
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 debugmode:
suite.debug()
else:
unittest.TextTestRunner(verbosity=1).run(suite)
if __name__ == '__main__':
def printUsage():
......@@ -47,13 +46,6 @@ if __name__ == '__main__':
elif len(sys.argv)>2:
printUsage()
if len(sys.argv) >= 2:
cmd = sys.argv[1]
else:
cmd = 'python'
for dir in 'gof compile scalar tensor sparse'.split():
os.system('cd %s; %s autotest.py %s' % (dir, cmd, debugparam))
test_root_dir(debugparam!="")
test_module("theano")
import unittest
from link import PerformLinker, Profiler
from cc import *
from type import Type
from graph import Result, Apply, Constant
from op import Op
import env
import toolbox
from theano.gof.link import PerformLinker, Profiler
from theano.gof.cc import *
from theano.gof.type import Type
from theano.gof.graph import Result, Apply, Constant
from theano.gof.op import Op
from theano.gof import env
from theano.gof import toolbox
def as_result(x):
assert isinstance(x, Result)
......
import unittest
from type import Type
import graph
from graph import Result, Apply
from op import Op
from opt import *
import destroyhandler
from env import Env, InconsistencyError
from toolbox import ReplaceValidate
from theano.gof.type import Type
from theano.gof import graph
from theano.gof.graph import Result, Apply
from theano.gof.op import Op
from theano.gof.opt import *
from theano.gof import destroyhandler
from theano.gof.env import Env, InconsistencyError
from theano.gof.toolbox import ReplaceValidate
from copy import copy
......
from collections import deque
import unittest
from graph import *
from theano.gof.graph import *
from op import Op
from type import Type
from graph import Result
from theano.gof.op import Op
from theano.gof.type import Type
from theano.gof.graph import Result
if 1:
......
......@@ -2,14 +2,14 @@
import unittest
import graph
from graph import Result, Apply, Constant
from type import Type
from op import Op
import env
import toolbox
from link import *
from theano.gof import graph
from theano.gof.graph import Result, Apply, Constant
from theano.gof.type import Type
from theano.gof.op import Op
from theano.gof import env
from theano.gof import toolbox
from theano.gof.link import *
#from _test_result import Double
......
import unittest
from copy import copy
from op import *
from type import Type, Generic
from graph import Apply, Result
from theano.gof.op import *
from theano.gof.type import Type, Generic
from theano.gof.graph import Apply, Result
def as_result(x):
assert isinstance(x, Result)
......
import unittest
from type import Type
from graph import Result, Apply, Constant
from op import Op
from opt import *
from env import Env
from toolbox import *
from theano.gof.type import Type
from theano.gof.graph import Result, Apply, Constant
from theano.gof.op import Op
from theano.gof.opt import *
from theano.gof.env import Env
from theano.gof.toolbox import *
def as_result(x):
......
import unittest
from graph import Result, Apply
from type import Type
from op import Op
from theano.gof.graph import Result, Apply
from theano.gof.type import Type
from theano.gof.op import Op
from env import Env, InconsistencyError
from toolbox import *
from theano.gof.env import Env, InconsistencyError
from theano.gof.toolbox import *
def as_result(x):
......
import unittest
from type import *
from theano.gof.type import *
# todo: test generic
......
......@@ -2,5 +2,4 @@
from basic import *
from basic import _abs
import opt
......@@ -4,10 +4,10 @@
#
import unittest
import numpy
import gof
from theano import gof
from gradient import *
import gradient
from theano.gradient import *
from theano import gradient
class _test_grad_sources_inputs(unittest.TestCase):
def test_retNone1(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论