Package pytils :: Package test
[hide private]

Source Code for Package pytils.test

 1  # -*- coding: utf-8 -*- 
 2  # pytils - simple processing for russian strings 
 3  # Copyright (C) 2006-2007  Yury Yurevich 
 4  # 
 5  # http://www.pyobject.ru/projects/pytils/ 
 6  # 
 7  # This program is free software; you can redistribute it and/or 
 8  # modify it under the terms of the GNU General Public License 
 9  # as published by the Free Software Foundation, version 2 
10  # of the License. 
11  # 
12  # This program is distributed in the hope that it will be useful, 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
15  # GNU General Public License for more details. 
16  """ 
17  Unit tests for pytils 
18  """ 
19   
20  __id__ = __revision__ = "$Id: __init__.py 102 2007-07-12 12:33:36Z the.pythy $" 
21  __url__ = "$URL: https://pythy.googlecode.com/svn/tags/pytils/0_2_2/pytils/test/__init__.py $" 
22  __all__ = ["test_numeral", "test_dt", "test_translit", "test_utils"] 
23   
24  import unittest 
25   
26 -def get_django_suite():
27 try: 28 import django 29 except ImportError: 30 return unittest.TestSuite() 31 32 import pytils.test.templatetags 33 return pytils.test.templatetags.get_suite()
34
35 -def get_suite():
36 """Return TestSuite for all unit-test of pytils""" 37 suite = unittest.TestSuite() 38 for module_name in __all__: 39 imported_module = __import__("pytils.test."+module_name, 40 globals(), 41 locals(), 42 ["pytils.test"]) 43 44 loader = unittest.defaultTestLoader 45 suite.addTest(loader.loadTestsFromModule(imported_module)) 46 suite.addTest(get_django_suite()) 47 48 return suite
49 50
51 -def run(verbosity=1):
52 """Run all unit-test of pytils""" 53 suite = get_suite() 54 unittest.TextTestRunner(verbosity=verbosity).run(suite)
55 56 if __name__ == '__main__': 57 run(2) 58