symbian-qemu-0.9.1-12/python-2.6.1/Lib/json/tests/__init__.py
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     1 import os
       
     2 import sys
       
     3 import unittest
       
     4 import doctest
       
     5 
       
     6 here = os.path.dirname(__file__)
       
     7 
       
     8 def test_suite():
       
     9     suite = additional_tests()
       
    10     loader = unittest.TestLoader()
       
    11     for fn in os.listdir(here):
       
    12         if fn.startswith("test") and fn.endswith(".py"):
       
    13             modname = "json.tests." + fn[:-3]
       
    14             __import__(modname)
       
    15             module = sys.modules[modname]
       
    16             suite.addTests(loader.loadTestsFromModule(module))
       
    17     return suite
       
    18 
       
    19 def additional_tests():
       
    20     import json
       
    21     import json.encoder
       
    22     import json.decoder
       
    23     suite = unittest.TestSuite()
       
    24     for mod in (json, json.encoder, json.decoder):
       
    25         suite.addTest(doctest.DocTestSuite(mod))
       
    26     return suite
       
    27 
       
    28 def main():
       
    29     suite = test_suite()
       
    30     runner = unittest.TextTestRunner()
       
    31     runner.run(suite)
       
    32 
       
    33 if __name__ == '__main__':
       
    34     sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
       
    35     main()