Mercurial > pylearn
view autotest.py @ 354:d580b3a369a4
dataset__call__() returns a FieldsSubsetDataSet, so still a subset of fields, but not cached any more. I added the function dataset.cached_fields_subset(self,*fieldnames) that returns the old version, cached, in case someone needs it. Current behaviour passes the tests.
author | Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca> |
---|---|
date | Thu, 19 Jun 2008 12:35:41 -0400 |
parents | 23981827b794 |
children |
line wrap: on
line source
import unittest, os, sys, traceback def test_root_dir(debugmode=False): suite = None filenames = os.listdir('.') for filename in filenames: if filename[-3:] == '.py' and filename.startswith('_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) if suite is None: print >>sys.stderr, "No suite found" sys.exit(1) if debugmode: suite.debug() else: unittest.TextTestRunner(verbosity=1).run(suite) 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() test_root_dir(debugparam!="")