From f08167dc59d10ab69b85d3aca80e890ffde086a1 Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Wed, 30 Jan 2013 21:34:48 +0100 Subject: [PATCH 1/9] Make phantomjs the default selenium driver --- froide/test_settings.py | 1 + froide/tests/live/test_request.py | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/froide/test_settings.py b/froide/test_settings.py index ac25f99de..d7b781e9a 100644 --- a/froide/test_settings.py +++ b/froide/test_settings.py @@ -237,6 +237,7 @@ TEST_RUNNER = 'discover_runner.DiscoverRunner' +TEST_SELENIUM_DRIVER = 'phantomjs' # south settings SOUTH_TESTS_MIGRATE = False diff --git a/froide/tests/live/test_request.py b/froide/tests/live/test_request.py index 57af64993..5b2b9f828 100644 --- a/froide/tests/live/test_request.py +++ b/froide/tests/live/test_request.py @@ -1,10 +1,10 @@ import time +from django.conf import settings from django.core.urlresolvers import reverse from django.test import LiveServerTestCase from django.contrib.auth.models import User -from selenium.webdriver.chrome.webdriver import WebDriver from selenium.webdriver.support.wait import WebDriverWait from froide.foirequest.tests import factories @@ -12,11 +12,24 @@ from froide.publicbody.models import PublicBody +def get_selenium(): + driver = getattr(settings, 'TEST_SELENIUM_DRIVER', 'firefox') + if driver == 'firefox': + from selenium.webdriver.firefox.webdriver import WebDriver as FirefoxDriver + return FirefoxDriver() + elif driver == 'chrome': + from selenium.webdriver.chrome.webdriver import WebDriver as ChromeDriver + return ChromeDriver() + elif driver == 'phantomjs': + from selenium.webdriver import PhantomJS + return PhantomJS() + + class TestMakingRequest(LiveServerTestCase): @classmethod def setUpClass(cls): - cls.selenium = WebDriver() + cls.selenium = get_selenium() cls.selenium.implicitly_wait(5) super(TestMakingRequest, cls).setUpClass() From f2c5f8cbf6bf02a476177c6890fe8b124acf4511 Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Wed, 30 Jan 2013 21:40:52 +0100 Subject: [PATCH 2/9] Reintegrate live tests into normal test run --- Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 24c283963..18c6adea5 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,5 @@ export DJANGO_SETTINGS_MODULE=froide.test_settings test: pep8 --ignore=E501,E124,E126,E127,E128 --exclude=migrations froide - coverage run --branch --source=froide `which django-admin.py` test froide.account.tests froide.foirequest.tests froide.foirequestfollower.tests froide.frontpage.tests froide.publicbody.tests + coverage run --branch --source=froide `which django-admin.py` test froide coverage report --omit="*/migrations/*" - -live: - coverage run --branch --source=froide `which django-admin.py` test froide.tests.live \ No newline at end of file From ea2c2e320c489d422729c9e76752d5542f88cf14 Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Sat, 2 Feb 2013 14:56:26 +0100 Subject: [PATCH 3/9] Upgrade to selenium 2.29.0 --- requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index 8777d1857..7ec26949c 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,4 @@ -r requirements.txt django-discover-runner==0.2.2 pyelasticsearch==0.2 -selenium==2.25.0 \ No newline at end of file +selenium==2.29.0 \ No newline at end of file From ec5ce4ef99133ce761996ed84abe86b3617306ee Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Sat, 2 Feb 2013 14:56:43 +0100 Subject: [PATCH 4/9] Include requirements.txt properly into terrarium --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 431e9b39b..2a587170b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ before_install: - export PIP_INDEX_URL=https://simple.crate.io/ install: - pip install terrarium boto -- terrarium key requirements-test.txt -- terrarium --target froideenv --remote-key-format "u/stwe/froideenv/%(arch)s-%(python_vmajor)s.%(python_vminor)s-%(digest)s" install requirements-test.txt || (wget "http://resources.opendatalabs.org.s3.amazonaws.com/u/stwe/froideenv/`terrarium key requirements-test.txt`" ; terrarium --no-upload --s3-bucket "" --target froideenv --storage-dir . install requirements-test.txt) +- terrarium key requirements.txt requirements-test.txt +- terrarium --target froideenv --remote-key-format "u/stwe/froideenv/%(arch)s-%(python_vmajor)s.%(python_vminor)s-%(digest)s" install requirements.txt requirements-test.txt || (wget "http://resources.opendatalabs.org.s3.amazonaws.com/u/stwe/froideenv/`terrarium key requirements.txt requirements-test.txt`" ; terrarium --no-upload --s3-bucket "" --target froideenv --storage-dir . install requirements.txt requirements-test.txt) - source froideenv/bin/activate - pip install -e . script: From 5e2cc4b62826c114037ee7b8ce29db243c9ce733 Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Sat, 2 Feb 2013 18:50:41 +0100 Subject: [PATCH 5/9] Revert "Include requirements.txt properly into terrarium" terrarium doesn't support -r style includes yet. This reverts commit 308ec6c89e16652837f7f63dd3f204065ea6d341. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2a587170b..431e9b39b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ before_install: - export PIP_INDEX_URL=https://simple.crate.io/ install: - pip install terrarium boto -- terrarium key requirements.txt requirements-test.txt -- terrarium --target froideenv --remote-key-format "u/stwe/froideenv/%(arch)s-%(python_vmajor)s.%(python_vminor)s-%(digest)s" install requirements.txt requirements-test.txt || (wget "http://resources.opendatalabs.org.s3.amazonaws.com/u/stwe/froideenv/`terrarium key requirements.txt requirements-test.txt`" ; terrarium --no-upload --s3-bucket "" --target froideenv --storage-dir . install requirements.txt requirements-test.txt) +- terrarium key requirements-test.txt +- terrarium --target froideenv --remote-key-format "u/stwe/froideenv/%(arch)s-%(python_vmajor)s.%(python_vminor)s-%(digest)s" install requirements-test.txt || (wget "http://resources.opendatalabs.org.s3.amazonaws.com/u/stwe/froideenv/`terrarium key requirements-test.txt`" ; terrarium --no-upload --s3-bucket "" --target froideenv --storage-dir . install requirements-test.txt) - source froideenv/bin/activate - pip install -e . script: From f46dc5e7583e3fe38dc377ff9b0baeee55d4e2f5 Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Tue, 12 Feb 2013 21:06:48 +0100 Subject: [PATCH 6/9] Run phantomjs before install in the background on default port --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 431e9b39b..1e30a8947 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ services: before_install: - export PIP_USE_MIRRORS=true - export PIP_INDEX_URL=https://simple.crate.io/ +- phantomjs --webdriver= & install: - pip install terrarium boto - terrarium key requirements-test.txt From 345a44399e835bc6e25fdc76c76f706af0734a46 Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Mon, 18 Feb 2013 11:38:10 +0100 Subject: [PATCH 7/9] Add debug info in travis build --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1e30a8947..2bfbedb59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,15 @@ services: before_install: - export PIP_USE_MIRRORS=true - export PIP_INDEX_URL=https://simple.crate.io/ +- phantomjs --version - phantomjs --webdriver= & install: - pip install terrarium boto - terrarium key requirements-test.txt - terrarium --target froideenv --remote-key-format "u/stwe/froideenv/%(arch)s-%(python_vmajor)s.%(python_vminor)s-%(digest)s" install requirements-test.txt || (wget "http://resources.opendatalabs.org.s3.amazonaws.com/u/stwe/froideenv/`terrarium key requirements-test.txt`" ; terrarium --no-upload --s3-bucket "" --target froideenv --storage-dir . install requirements-test.txt) - source froideenv/bin/activate -- pip install -e . +- which python +- python setup.py develop --prefix=`pwd`/froideenv script: - make test branches: From bf0f19fad1fe5278275771843f61f54ded2e36e0 Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Mon, 18 Feb 2013 12:42:03 +0100 Subject: [PATCH 8/9] Add debug level output for terrarium --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2bfbedb59..d748ad0ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ before_install: install: - pip install terrarium boto - terrarium key requirements-test.txt -- terrarium --target froideenv --remote-key-format "u/stwe/froideenv/%(arch)s-%(python_vmajor)s.%(python_vminor)s-%(digest)s" install requirements-test.txt || (wget "http://resources.opendatalabs.org.s3.amazonaws.com/u/stwe/froideenv/`terrarium key requirements-test.txt`" ; terrarium --no-upload --s3-bucket "" --target froideenv --storage-dir . install requirements-test.txt) +- terrarium --virtualenv-log-level 10 --pip-log-level 10 --target froideenv --remote-key-format "u/stwe/froideenv/%(arch)s-%(python_vmajor)s.%(python_vminor)s-%(digest)s" install requirements-test.txt || (wget "http://resources.opendatalabs.org.s3.amazonaws.com/u/stwe/froideenv/`terrarium key requirements-test.txt`" ; terrarium --pip-log-level 10 --virtualenv-log-level 10 --no-upload --s3-bucket "" --target froideenv --storage-dir . install requirements-test.txt) - source froideenv/bin/activate - which python - python setup.py develop --prefix=`pwd`/froideenv From 21984978933d7c6f998fadfff1ea416c54f07729 Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Mon, 18 Feb 2013 12:58:07 +0100 Subject: [PATCH 9/9] Upgrade to terrarium master --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d748ad0ef..651b544a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ before_install: - phantomjs --version - phantomjs --webdriver= & install: -- pip install terrarium boto +- pip install https://github.com/PolicyStat/terrarium/archive/master.zip boto - terrarium key requirements-test.txt - terrarium --virtualenv-log-level 10 --pip-log-level 10 --target froideenv --remote-key-format "u/stwe/froideenv/%(arch)s-%(python_vmajor)s.%(python_vminor)s-%(digest)s" install requirements-test.txt || (wget "http://resources.opendatalabs.org.s3.amazonaws.com/u/stwe/froideenv/`terrarium key requirements-test.txt`" ; terrarium --pip-log-level 10 --virtualenv-log-level 10 --no-upload --s3-bucket "" --target froideenv --storage-dir . install requirements-test.txt) - source froideenv/bin/activate