Commits

Mikhail Korobov  committed 5af6170

Speed-up tests by installing pip requirements from downloaded tarballs (rerun preparevm.py)

  • Participants
  • Parent commits dcd95f2

Comments (0)

Files changed (18)

File docs/testing.rst

 for running tests and (optionally) `coverage.py`_ for test coverage reports::
 
     pip install -U fabtest
-    pip install mock==0.8
+    pip install 'mock==0.8'
     pip install coverage
 
 Please follow `instructions <http://pypi.python.org/pypi/fabtest>`_ for

File fab_deploy_tests/preparevm.py

 #!/usr/bin/env python
 import sys
-from fabric.api import env
+from fabric.api import env, sudo, run
 from fabtest import fab, VirtualBox
-from utils import setup_ssh, setup_sudo, private_key_path
 
 from fab_deploy.utils import update_env
 from fab_deploy.system import prepare
 from fab_deploy.db import mysql, postgres
 from fab_deploy.webserver import nginx, apache
 
+from utils import setup_ssh, setup_sudo, private_key_path
+
+def _download_pip_requirements():
+    DIR = '/tmp/sdist'
+    run('mkdir -p %s' % DIR)
+    reqs = [
+        'django == 1.2.5',
+        'django == 1.4',
+        'mysql-python == 1.2.3',
+        'psycopg2 == 2.4.5',
+        'South == 0.7.5',
+        'port-for == 0.3',
+    ]
+    for req in reqs:
+        run("pip install -d %s '%s'" % (DIR, req))
+
+    run('chmod 0777 -R %s' % DIR)
+
+
 def deep_prepare(name):
     """ Deep VM preparation for test speedups.
     Should only be run if all related tests are passed.
     env.hosts = ['foo@127.0.0.1:2222']
     env.password = '123'
     env.disable_known_hosts = True
-    env.conf = {'DB_PASSWORD': '123', 'DB_USER': 'root'}
+    env.conf = {'DB_PASSWORD': '123', 'DB_USER': 'root', 'DB_BACKEND': 'mysql'}
     env.key_filename = private_key_path()
     update_env()
 
         setup_sudo()
         setup_ssh()
         fab(prepare)
-        fab(apache.install)
+        fab(apache.install, confirm=False)
         fab(nginx.install)
         fab(mysql.install)
         fab(postgres.install)
+        fab(_download_pip_requirements)
         box.snapshot_take('fabtest-prepared-server')
 
     box.stop()

File fab_deploy_tests/test_project/reqs/all.txt

 -r basic.txt
 -r django.txt
 -r apps.txt
+
+# this is here in order to speed up tests
+--find-links file:///tmp/sdist/
+--index-url file:///dev/null

File fab_deploy_tests/test_project2/.git/COMMIT_EDITMSG

-Project is updated to use mysql
+updated files

File fab_deploy_tests/test_project2/.git/index

Binary file modified.

File fab_deploy_tests/test_project2/.git/logs/HEAD

 0000000000000000000000000000000000000000 70a846be7991b72791ef556f731fe5fcca74d200 Mikhail Korobov <kmike84@gmail.com> 1299875649 +0500	commit (initial): initial commit
 70a846be7991b72791ef556f731fe5fcca74d200 25614a57709a7bbf22607752714a2a11010055a7 Mikhail Korobov <kmike84@gmail.com> 1303344241 +0600	commit: Project is updated to use mysql
+25614a57709a7bbf22607752714a2a11010055a7 c137b4363b99aeb21241e7f41e32d152d8c89a2a Mikhail Korobov <kmike84@gmail.com> 1340177751 +0600	commit: updated files

File fab_deploy_tests/test_project2/.git/logs/refs/heads/master

 0000000000000000000000000000000000000000 70a846be7991b72791ef556f731fe5fcca74d200 Mikhail Korobov <kmike84@gmail.com> 1299875649 +0500	commit (initial): initial commit
 70a846be7991b72791ef556f731fe5fcca74d200 25614a57709a7bbf22607752714a2a11010055a7 Mikhail Korobov <kmike84@gmail.com> 1303344241 +0600	commit: Project is updated to use mysql
+25614a57709a7bbf22607752714a2a11010055a7 c137b4363b99aeb21241e7f41e32d152d8c89a2a Mikhail Korobov <kmike84@gmail.com> 1340177751 +0600	commit: updated files

File fab_deploy_tests/test_project2/.git/objects/10/e9eb6f5a80cfb3456b9bd7b0e1a504b692a482

+x=�1�0
+k�"�m��v��ߪ�������/҉0'

File fab_deploy_tests/test_project2/.git/objects/3b/3b5ca0bb60008bd8e2323b059f9af93167b8fa

Binary file added.

File fab_deploy_tests/test_project2/.git/objects/56/855cf94ab80790427c3718108c365a99e02300

Binary file added.

File fab_deploy_tests/test_project2/.git/objects/69/9d1bd09ca3106afb09d3599deb8f6d278482ac

Binary file added.

File fab_deploy_tests/test_project2/.git/objects/87/940248cc1f35b3bae2264ac56ec3d5ffe9fc02

Binary file added.

File fab_deploy_tests/test_project2/.git/objects/98/a4a95e955694d66f9019ffe9d08a949a90755b

Binary file added.

File fab_deploy_tests/test_project2/.git/objects/c1/37b4363b99aeb21241e7f41e32d152d8c89a2a

Binary file added.

File fab_deploy_tests/test_project2/.git/refs/heads/master

-25614a57709a7bbf22607752714a2a11010055a7
+c137b4363b99aeb21241e7f41e32d152d8c89a2a

File fab_deploy_tests/test_project2/requirements.txt

-django==1.2.5
-mysql-python >= 1.2
+django == 1.2.5
+mysql-python == 1.2.3
+
+# this is here in order to speed up tests
+--find-links file:///tmp/sdist/
+--index-url file:///dev/null

File fab_deploy_tests/test_project3/test_project3/reqs/all.txt

 django == 1.4
-psycopg2
-South
+psycopg2 == 2.4.5
+South == 0.7.5
+
+# this is here in order to speed up tests
+--find-links file:///tmp/sdist/
+--index-url file:///dev/null

File fab_deploy_tests/tests/deploy.py

 from fab_deploy.utils import run_as
 from fab_deploy.deploy import deploy_project, push, remove
 from fab_deploy.db import mysql, postgres, postgis
-from fab_deploy import db
 from fab_deploy.webserver import apache
 from fab_deploy.django_commands import command_is_available
 from .base import FabDeployTest