Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
skoczen committed Sep 13, 2011
0 parents commit 391a2d4
Show file tree
Hide file tree
Showing 12 changed files with 1,562 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
*.pyc
*.pyc
*.pyo
*.swp
pip-log.txt
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This project will (but does not yet) provide a fairly easy way to get up and running with functional tests for Django.

It's currently in the process of being abstracted from some integrated, in-house code. This README will be updated when that changes.
Empty file added functional_tests/__init__.py
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from django.conf import settings
from django.core.management.base import BaseCommand
from django.core.management import call_command
import subprocess
from os.path import abspath, join
import time

class Command(BaseCommand):
help = "Run the selenium tests."
__test__ = False

def handle(self, *args, **options):
output = file('/dev/null', 'a+')
lots_of_options_dict = {
've_path': settings.VIRTUALENV_PATH,
'http_port': settings.LIVE_SERVER_PORT,
'test_server_settings': settings.SELENIUM_TEST_SERVER_SETTINGS,
'lib_path' : join(abspath(settings.PROJECT_ROOT), "lib"),
"selenium_port": settings.SELENIUM_PORT,
}

sel_command = "java -jar %(lib_path)s/selenium-server.jar -timeout 30 -port %(selenium_port)s -userExtensions %(lib_path)s/user-extensions.js" % lots_of_options_dict
gun_command = "sleep 5;%(ve_path)s/bin/python manage.py run_gunicorn -w 2 -b 0.0.0.0:%(http_port)s --settings=envs.%(test_server_settings)s" % lots_of_options_dict
cel_command = "sleep 5;python manage.py celeryd --settings=envs.%(test_server_settings)s" % lots_of_options_dict
selenium_subprocess = subprocess.Popen(sel_command,shell=True, stderr=output, stdout=output)
gunicorn_subprocess = subprocess.Popen(gun_command,shell=True, stderr=output, stdout=output)
celery_subprocess = subprocess.Popen(cel_command,shell=True, stderr=output, stdout=output)
try:
call_command('test', "--with-selenium", "--with-selenium-fixtures", "--with-xunit",
"--with-xcoverage", *args, xcoverage_file="coverage.xml", xunit_file="xmlrunner/nosetests.xml", **options )
output.close()
except:
pass

try:
selenium_subprocess.kill()
except:
pass

try:
gunicorn_subprocess.kill()
except:
pass

try:
celery_subprocess.kill()
except:
pass

time.sleep(6)
Binary file not shown.
Loading

0 comments on commit 391a2d4

Please sign in to comment.