-
-
Save tyndyll/dac557c1dc81dbacfb6402eb7267d113 to your computer and use it in GitHub Desktop.
Revisions
-
mcbhenwood revised this gist
Nov 8, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Requires Xvfb and IceWeasel to be installed. For Debian flavours: sudo apt-get install xvfb iceweasel For details, see: http://pyuseful.wordpress.com/2012/11/08/running-cucumber-style-tests-in-django-using-behave/ -
mcbhenwood revised this gist
Nov 8, 2012 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,9 @@ sudo apt-get install xvfm iceweasel For details, see: http://pyuseful.wordpress.com/2012/11/08/running-cucumber-style-tests-in-django-using-behave/ """ import os from os.path import abspath, join, split @@ -47,4 +50,4 @@ def run(): if __name__ == '__main__': run() -
mcbhenwood created this gist
Nov 8, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ """ Run Selenium headless tests against Django test server ------------------------------------------------------ Creates and destroys a test environment each time. Requires Xvfb and IceWeasel to be installed. For Debian flavours: sudo apt-get install xvfm iceweasel """ import os from os.path import abspath, join, split import subprocess import sys import time from behave.__main__ import main as behave_main DJANGO_PROJECT_DIR = 'djangoproject' # Substitute your top level Django project folder name if __name__ == '__main__': project_dir = split(abspath(__file__))[0] sys.path.insert(0, join(project_dir, DJANGO_PROJECT_DIR)) def run(): print('Starting django testserver') django_process = subprocess.Popen( ['python', join(DJANGO_PROJECT_DIR, 'manage.py'), 'testserver', '--noinput'], stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w')) time.sleep(2) print('Starting Xvfb') xvfb_process = subprocess.Popen( ['Xvfb', ':99', '-ac', '-screen', '0', '1024x768x8']) os.environ["DISPLAY"] = ":99" try: behave_main() # This calls sys.exit() under all circumstances finally: print('Stopping django testserver') django_process.terminate() print('Stopping Xvfb') xvfb_process.terminate() if __name__ == '__main__': run()