Package Martel :: Package test :: Module run_tests
[hide private]
[frames] | no frames]

Source Code for Module Martel.test.run_tests

 1  # test suite for the formats 
 2  import os, glob, imp, sys 
 3   
4 -def main(args):
5 try: 6 dirname = os.path.dirname(__file__) 7 except NameError: 8 dirname = "." 9 files = glob.glob(os.path.join(dirname, "test_*.py")) 10 files.sort() 11 12 for file in files: 13 name = os.path.basename(file) 14 name = os.path.splitext(name)[0] 15 print "###### running tests in", name, "###############" 16 module = __import__(name) 17 module.test()
18 19 # Run tests uses the local (uninstalled) files
20 -def local_test_main(args):
21 # Find the directory containing the Martel code. 22 # In biopython CVS this is named 'Martel'. In a standalone release 23 # it could be named something like 'Martel-0.8'. Discover which. 24 sys.path.insert(0, "..") 25 filename = os.path.abspath(__file__) 26 dirname = os.path.dirname(os.path.dirname(filename)) 27 28 # Force module loading. 29 imp.load_module("Martel", open("../__init__.py"), dirname, 30 (".py", "r", imp.PKG_DIRECTORY)) 31 32 # Do the normal tests 33 return main(args)
34 35 # Run tests uses the installed files (not the ones in ..) 36 install_test_main = main 37 38 if __name__ == "__main__": 39 install_test_main([]) 40