run_unit_tests.py 628 B

1234567891011121314151617181920212223242526
  1. #Developed with Python 2.7.15+
  2. #Might not run with other versions.
  3. #What this program does:
  4. #Recursively traverse the game's folders
  5. #If a folder contains a folder called 'tests', runs them with busted
  6. #requires busted to be installed
  7. import subprocess
  8. import os
  9. def find_and_run_tests(path):
  10. files = os.listdir(path)
  11. for f in files:
  12. childpath = os.path.join(path, f)
  13. if f == "tests":
  14. subprocess.call(["cd " + path + " && busted " + "."], shell = True)
  15. elif os.path.isdir(childpath):
  16. find_and_run_tests(childpath)
  17. dirname, filename = os.path.split(os.path.abspath(__file__))
  18. find_and_run_tests(dirname)