/test_all_versions

https://bitbucket.org/bconstantin/django_polymorphic/ · #! · 73 lines · 62 code · 11 blank · 0 comment · 0 complexity · 366ef370c38ba3e42f96d17c75402d3c MD5 · raw file

  1. #!/bin/bash
  2. # this test script runs "./manage.py test" for
  3. # all supported python versions (2.4, 2.5, 2.6)
  4. # and all supported Django versions (1.1, 1.2, 1.3)
  5. # it needs symbolic links named "django1.1" and "django1.2" etc. in:
  6. # libraries-local/django-versions
  7. # which point to the respective django versions
  8. cd libraries-local
  9. rm -f django-orig
  10. if test -e django ; then mv django django-orig ; fi
  11. cd ..
  12. function restore_django {
  13. echo "### restoring original libraries-local/django"
  14. cd libraries-local
  15. if test -e django-orig ; then mv django-orig django ; fi
  16. cd .
  17. }
  18. function test_python_version {
  19. echo ; echo ; echo
  20. echo "#########################################################################"
  21. echo "### Testing Python $1, Django $2"
  22. echo "#########################################################################"
  23. echo
  24. if which python$1 ; then
  25. if ! python$1 manage.py test polymorphic; then
  26. echo ERROR
  27. restore_django
  28. exit 10
  29. fi
  30. if ! ./test_dumpdata $1 ; then
  31. echo ERROR
  32. restore_django
  33. exit 10
  34. fi
  35. else
  36. echo
  37. echo "### python $1 is not installed!"
  38. echo
  39. fi
  40. }
  41. function test_all_python_versions {
  42. test_python_version 2.4 $1
  43. test_python_version 2.5 $1
  44. test_python_version 2.6 $1
  45. }
  46. function test_django_version {
  47. if ! test -e libraries-local/django-versions/django$1 ; then
  48. echo
  49. echo "### django $1 is not installed!"
  50. echo
  51. return
  52. fi
  53. cd libraries-local
  54. rm -f django
  55. ln -s django-versions/django$1 django
  56. cd ..
  57. test_all_python_versions $1
  58. }
  59. test_django_version 1.1
  60. test_django_version 1.2
  61. test_django_version 1.3
  62. restore_django