Attachment 'alltests.py'

Download

   1 #!/usr/bin/env python
   2 
   3 import unittest
   4 import sys
   5 import os
   6 
   7 sys.path.append(os.curdir)
   8 sys.path.append(os.pardir)
   9 sys.path.append(os.path.join(os.curdir, 'tests'))
  10 
  11 tests = os.listdir(os.curdir)
  12 tests = [n[:-3] for n in tests if n.startswith('test') and n.endswith('.py')]
  13 
  14 teststests = os.path.join(os.curdir, 'tests')
  15 if os.path.isdir(teststests):
  16     teststests = os.listdir(teststests)
  17     teststests = [n[:-3] for n in teststests if n.startswith('test') \
  18             and n.endswith('.py')]
  19     modules_to_test = tests + teststests
  20 else:
  21     modules_to_test = tests
  22 
  23 def suite():
  24     alltests = unittest.TestSuite()
  25     for module in map(__import__, modules_to_test):
  26         alltests.addTest(unittest.findTestCases(module))
  27     return alltests
  28 
  29 if __name__ == '__main__':
  30     unittest.main(defaultTest='suite')

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2021-05-11 08:52:37, 0.8 KB) [[attachment:alltests.py]]
  • [get | view] (2021-05-11 08:52:37, 0.1 KB) [[attachment:skeleton.py]]
  • [get | view] (2021-05-11 08:52:37, 0.3 KB) [[attachment:test.py]]
  • [get | view] (2021-05-11 08:52:37, 4.7 KB) [[attachment:xyb.vimrc]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.