runtests.py 513 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python
  2. from __future__ import print_function
  3. import glob
  4. import os
  5. import shutil
  6. import subprocess
  7. import sys
  8. TEST_FILE = 'test_python_startup.py'
  9. for f in glob.glob('*.py[cod]'):
  10. os.remove(f)
  11. shutil.rmtree('__pycache__', ignore_errors=True)
  12. print('Running Python2 tests:')
  13. py2tests = subprocess.call(['python2', TEST_FILE])
  14. print('Running Python3 tests:')
  15. py3tests = subprocess.call(['python3', TEST_FILE])
  16. if py2tests != 0 or py3tests != 0:
  17. print('Tests failed.')
  18. sys.exit(1)