runtests.py 922 B

12345678910111213141516171819202122232425
  1. def runtests():
  2. import os
  3. import shutil
  4. import sys
  5. test_runner_path = os.path.dirname(__file__)
  6. project_template_path = os.path.join(
  7. test_runner_path, 'misago/project_template/project_name')
  8. test_project_path = os.path.join(test_runner_path, "testproject")
  9. if not os.path.exists(test_project_path):
  10. shutil.copytree(project_template_path, test_project_path)
  11. settings_path = os.path.join(test_project_path, "settings.py")
  12. with open(settings_path, "r") as py_file:
  13. settings_file = py_file.read().replace("{{ project_name }}",
  14. "testproject")
  15. with open(settings_path, "w") as py_file:
  16. py_file.write(settings_file)
  17. os.environ["DJANGO_SETTINGS_MODULE"] = "testproject.settings"
  18. from south.management.commands import test
  19. sys.exit(test.Command().execute(verbosity=1))