Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

runtests.py 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. parser = OptionParser()
  17. parser.add_option('--with-coverage', dest='coverage', default=False,
  18. action='store_true')
  19. parser.add_option('--with-xunit', dest='xunit', default=False,
  20. action='store_true')
  21. parser.add_option('--collect-only', dest='collect', default=False,
  22. action='store_true')
  23. options, args = parser.parse_args()
  24. if options.collect:
  25. # Show tests only so a bash autocompleter can use the results
  26. configure(['-v'])
  27. run_tests()
  28. else:
  29. # If no args, then use 'progressive' plugin to keep the screen real
  30. # estate used down to a minimum. Otherwise, use the spec plugin
  31. nose_args = ['-s', '-x']
  32. if args:
  33. nose_args.extend(['--with-specplugin'])
  34. else:
  35. nose_args.append('--with-progressive')
  36. if options.coverage:
  37. # Nose automatically uses any options passed to runtests.py, which
  38. # is why the coverage trigger uses '--with-coverage' and why we
  39. # don't need to explicitly include it here.
  40. nose_args.extend([
  41. '--cover-package=oscar', '--cover-html',
  42. '--cover-html-dir=htmlcov'])
  43. configure(nose_args)
  44. run_tests(*args)