您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

runtests.py 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env python
  2. import sys
  3. import logging
  4. from optparse import OptionParser
  5. from tests.config import configure
  6. logging.disable(logging.CRITICAL)
  7. def run_tests(*test_args):
  8. from django_nose import NoseTestSuiteRunner
  9. test_runner = NoseTestSuiteRunner()
  10. if not test_args:
  11. test_args = ['tests']
  12. num_failures = test_runner.run_tests(test_args)
  13. if num_failures:
  14. sys.exit(num_failures)
  15. if __name__ == '__main__':
  16. args = sys.argv[1:]
  17. if not args:
  18. # If no args, then use 'progressive' plugin to keep the screen real
  19. # estate used down to a minimum. Otherwise, use the spec plugin
  20. args = ['-s', '-x', '--with-progressive']
  21. else:
  22. # Some args specified. Check to see if any nose options have been
  23. # specified. If they have, then don't set any
  24. has_options = any(map(lambda x: x.startswith('--'), args))
  25. if not has_options:
  26. args.extend(['-s', '-x', '--with-specplugin'])
  27. else:
  28. # Remove options as nose will pick these up from sys.argv
  29. args = [arg for arg in args if not arg.startswith('-')]
  30. configure()
  31. run_tests(*args)