dbtest_all.py 490 B

1234567891011121314151617181920
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import os
  4. import unittest
  5. def suite():
  6. suite = unittest.TestSuite()
  7. for _, _, files in os.walk('.'):
  8. for name in filter(is_test, files):
  9. tests = unittest.defaultTestLoader.loadTestsFromName(name[:-3])
  10. suite.addTests(tests)
  11. return suite
  12. def is_test(filename):
  13. return filename.startswith('dbtest_') and filename.endswith('.py')
  14. if __name__ == "__main__":
  15. unittest.main(defaultTest="suite")