def test_pip_install_requirements(): #output.debug = True #Ensure nothing already there local('rm -f dist/requirements1-0.1.pybundle') local('rm -f requirements.txt') local('rm -f requirements1.txt') local('rm -f pip*') rmvirtualenv() set_server_state('pip_installed_example_project-0.1', delete=True) #Try installing without an virtual env which should fail p = pip_install_requirements() assert not p v = mkvirtualenv() #c = confirm('PROCEED Install Just woven & django') ##Install Just woven & django env.DJANGO_REQUIREMENT='file://'+os.path.join(os.getcwd(),'dist','Django-1.2.1.tar.gz') p = pip_install_requirements() assert exists('/home/woven/example.com/env/example_project-0.1/lib/python2.6/site-packages/django') set_server_state('pip_installed_example_project-0.1', delete=True) local("echo 'django-staticfiles' >> requirements1.txt") ##Install our example staticfiles #c = confirm('PROCEED Install staticfiles') p = pip_install_requirements() assert p assert exists('/home/woven/example.com/env/example_project-0.1/lib/python2.6/site-packages/staticfiles') #c = confirm('PROCEED fail test') #Try installing again - should fail p = pip_install_requirements() assert not p #c = confirm('PROCEED rollback') #Try rolling back installation pip_install_requirements(rollback=True) #assert not exists('/home/woven/example.com/env/example_project-0.1/lib/python2.6/site-packages/staticfiles') assert not exists('/home/woven/example.com/dist/') assert not exists('/home/woven/example.com/package-cache/') #c = confirm('PROCEED bundle') #Bundle something up into the dist directory bundle() p = pip_install_requirements() assert exists('/home/woven/example.com/dist/requirements1-0.1.pybundle') assert exists('/home/woven/example.com/env/example_project-0.1/lib/python2.6/site-packages/staticfiles') ##Finally clean up #Test to ensure it doesn't delete everything - BROKEN #put('dist/example_project-0.1.pybundle','/home/woven/example.com/dist/example_project-0.2.pybundle') #pip_install_requirements(rollback=True) #assert exists('/home/woven/example.com/dist/example_project-0.2.pybundle') rmvirtualenv() local('rm -f dist/example_project-0.1.pybundle') local('rm -f requirements.txt') local('rm -f requirements1.txt') set_server_state('pip_installed_example_project-0.1', delete=True)
def deploy(overwrite=False): """ deploy a versioned project on the host """ check_settings() if overwrite: rmvirtualenv() deploy_funcs = [deploy_project,deploy_templates, deploy_static, deploy_media, deploy_webconf, deploy_wsgi] if not patch_project() or overwrite: deploy_funcs = [deploy_db,mkvirtualenv,pip_install_requirements] + deploy_funcs for func in deploy_funcs: func()
def deploy(overwrite=False): """ deploy a versioned project on the host """ check_settings() if overwrite: rmvirtualenv() deploy_funcs = [ deploy_project, deploy_templates, deploy_static, deploy_media, deploy_webconf, deploy_wsgi ] if not patch_project() or overwrite: deploy_funcs = [deploy_db, mkvirtualenv, pip_install_requirements ] + deploy_funcs for func in deploy_funcs: func()
def test_virtualenv(): #Ensure we're cleared out set_server_state('created_virtualenv_example_project-0.1', delete=True) set_server_state('created_virtualenv_example_project-0.2', delete=True) v = mkvirtualenv() #Returns True if it is created assert v assert exists('/home/woven/example.com/env/example_project-0.1/bin/python') v = mkvirtualenv() #Returns False if not created. assert not v #test updating the version no# v = mkvirtualenv('0.2') #teardown assert exists('/home/woven/example.com/env/example_project-0.2/bin/python') rmvirtualenv('0.2') assert not exists('/home/woven/example.com/env/example_project-0.2/bin/python') assert exists('/home/woven/example.com/env/example_project-0.1/bin/python') rmvirtualenv() assert not exists('/home/woven/example.com') assert not server_state('created_virtualenv_example_project-0.2')