run_tests.py 619 B

1234567891011121314151617181920212223
  1. import os
  2. def test_file(filepath):
  3. return os.system("./pocketpy " + filepath) == 0
  4. #return os.system("python3 " + filepath) == 0
  5. def test_dir(path):
  6. has_error = False
  7. for filename in os.listdir(path):
  8. if filename.endswith('.py'):
  9. filepath = os.path.join(path, filename)
  10. code = test_file(filepath)
  11. if not code:
  12. print("[x] " + filepath)
  13. has_error = True
  14. else:
  15. print("[√] " + filepath)
  16. return not has_error
  17. if __name__ == '__main__':
  18. ok = test_dir('./tests')
  19. if not ok:
  20. exit(1)