From 37abb7aad1507be98f83240452349fad075c76ee Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 17 May 2012 10:50:41 -0400 Subject: [PATCH] Search the path for both django-admin.py and django-admin when running tests --- rakefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rakefile b/rakefile index 4644f30680..df0db9a56d 100644 --- a/rakefile +++ b/rakefile @@ -29,6 +29,11 @@ INSTALL_DIR_PATH = File.join(DEPLOY_DIR, NORMALIZED_DEPLOY_NAME) CLOBBER.include(BUILD_DIR, REPORT_DIR, 'cover*', '.coverage') CLEAN.include("#{BUILD_DIR}/*.deb", "#{BUILD_DIR}/util") +def select_executable(*cmds) + cmds.find_all{ |cmd| system("which #{cmd} > /dev/null 2>&1") }[0] || fail("No executables found from #{cmds.join(', ')}") +end + + task :default => [:pep8, :pylint, :test] directory REPORT_DIR @@ -47,7 +52,8 @@ end task :test => REPORT_DIR do ENV['NOSE_XUNIT_FILE'] = File.join(REPORT_DIR, "nosetests.xml") - sh("django-admin.py test --settings=envs.test --pythonpath=. $(ls djangoapps)") + django_admin = ENV['DJANGO_ADMIN_PATH'] || select_executable('django-admin.py', 'django-admin') + sh("#{django_admin} test --settings=envs.test --pythonpath=. $(ls djangoapps)") end task :package do