daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest Feb 21st, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. # -*- coding: UTF-8 -*-
  3. import os, re, sys, unittest
  4.  
  5. home = os.getcwd()[:-12]
  6. sys.path.append('%s/lib/google_appengine/lib/webapp2' % home)
  7. print '%s/lib/google_appengine/lib/webapp2' % home
  8. sys.path.append('%s/lib/gaepytz/pytz' % home)
  9. sys.path.append('%s/lib/google_appengine' % home)
  10. #sys.path.append('/home/user/lib/google_appengine/lib')
  11. sys.path.append('%s/lib/WTForms-1.0.1' % home)
  12. sys.path.append('%s/lib/Babel-0.9.6/babel' % home)
  13. sys.path.append('%s/lib/google_appengine/lib/yaml/lib' % home)
  14. sys.path.append('%s/lib/google_appengine/lib/jinja2' % home)
  15. sys.path.append('%s/devl/letzgo' % home)
  16. cwd = os.getcwd()
  17.  
  18. def mess():
  19.     print u"""
  20.     ____________________________________________________________________
  21.     --------------------------------------------------------------------
  22.     ВНИМАНИЕ ОШИБКА импорта, нажмите ввод для продолжения...
  23.     --------------------------------------------------------------------
  24.     ____________________________________________________________________
  25.     """
  26.     raw_input()
  27.  
  28. def runtests():
  29.     loader = unittest.TestLoader()
  30.     suite = unittest.TestSuite()
  31.  
  32.     try:
  33.         print 'start bob.tests'
  34.         import bob.tests
  35.         suite.addTests(loader.loadTestsFromModule(bob.tests))
  36.     except:
  37.         print 'import error bob.tests................false'
  38.         mess()
  39.        
  40.     try:
  41.         print 'start utils.tests'
  42.         import utils.tests
  43.         suite.addTests(loader.loadTestsFromModule(utils.tests))
  44.     except:
  45.         print 'import error utils.tests................false'
  46.         mess()
  47.  
  48.     try:
  49.         print 'start sob.tests'
  50.         import sob.tests
  51.         suite = loader.loadTestsFromModule(sob.tests)
  52.     except:
  53.         print 'import error sob.tests................false'
  54.         mess() 
  55.        
  56.     runner = unittest.TextTestRunner(verbosity=2)
  57.     result = runner.run(suite)
  58.  
  59.  
  60. def paths():
  61.     cwd = os.getcwd()
  62.     if not os.path.split(cwd)[1] == 'letzgo':
  63.         print 'Were are you?'
  64.         StandardError
  65.         raw_input('change dir')
  66.     return os.walk(cwd)
  67.      
  68.      
  69. def files():   
  70.     trees = paths()
  71.     i = 1
  72.     print 'All you tests in:'
  73.     for tree in trees:
  74.         if re.search(u'(/\.).*', tree[0]):
  75.             continue
  76.         for files in tree[2]:
  77.             if re.search('^(test).*(\.py)$', files):
  78.                 tests = tree[0]+'/'+files      
  79.                 tests = tests.replace('/','.')
  80.                 tests = tests[23:-3]
  81.                 print tests
  82.  
  83. if __name__ == '__main__'
  84.     files()
  85.     answer = raw_input('Run?')
  86.     if not answer in ('n','N','NOT'):
  87.         runtests()
  88.     else:
  89.         print 'tests dont run'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top