Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

runtests.py 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. options, args = parser.parse_args()
  22. # If no args, then use 'progressive' plugin to keep the screen real estate
  23. # used down to a minimum. Otherwise, use the spec plugin
  24. nose_args = ['-s', '-x',
  25. '--with-progressive' if not args else '--with-spec']
  26. if options.coverage:
  27. # Nose automatically uses any options passed to runtests.py, which is
  28. # why the coverage trigger uses '--with-coverage' and why we don't need
  29. # to explicitly include it here.
  30. nose_args.extend([
  31. '--cover-package=oscar', '--cover-html',
  32. '--cover-html-dir=htmlcov'])
  33. configure(nose_args)
  34. run_tests(*args)