#!/usr/bin/env python
#
# Run all tests in the current directory
# Execute like:
#   python runalltests.py

import unittest
import gettext
import sys,os

def find_PythonPath(recurse, dir, names):
    sys.path.append(dir)

def suite():
    """Make the test suite"""
    modules_to_test = ('llazymodeltest', 'llazyviewtest') # and so on
    alltests = unittest.TestSuite()
    for module in map(__import__, modules_to_test):
        alltests.addTest(unittest.findTestCases(module))
    return alltests

def run_tests():
    """Run all tests"""
    
    ## find dir and add them to python path
    os.chdir('../src')
    os.path.walk(os.getcwd(), find_PythonPath, '-R' in sys.argv)

    runner = unittest.TextTestRunner(stream=sys.stdout, descriptions=0, verbosity=2)
    
    print 'Loading test modules... ',
    alltest = suite()
    print 'done'
    
    runner.run(alltest)
    
if __name__ == '__main__':
    """The main function"""
    gettext.install('llazy', 'po')
    run_tests()
    



