選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

runtests.py 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env python
  2. import sys
  3. import logging
  4. from tests.config import configure
  5. logging.disable(logging.CRITICAL)
  6. def run_tests(*test_args):
  7. from django_nose import NoseTestSuiteRunner
  8. test_runner = NoseTestSuiteRunner()
  9. if not test_args:
  10. test_args = ['tests']
  11. num_failures = test_runner.run_tests(test_args)
  12. if num_failures:
  13. sys.exit(num_failures)
  14. if __name__ == '__main__':
  15. args = sys.argv[1:]
  16. if not args:
  17. import multiprocessing
  18. try:
  19. num_cores = multiprocessing.cpu_count()
  20. except NotImplementedError:
  21. num_cores = 4
  22. args = ['-s', '-x', '--processes=%s' % num_cores]
  23. else:
  24. # Some args specified. Check to see if any nose options have been
  25. # specified. If they have, then don't set any
  26. has_options = any(map(lambda x: x.startswith('--'), args))
  27. if not has_options:
  28. args.extend(['-s', '-x', '--with-specplugin'])
  29. else:
  30. # Remove options as nose will pick these up from sys.argv
  31. args = [arg for arg in args if not arg.startswith('-')]
  32. configure()
  33. run_tests(*args)