示例#1
0
文件: fabfile.py 项目: rootart/woven
def test_activate():
    sudo('rm -rf /home/woven/example.com')
    set_server_state('deployed_project_example_project-0.1',delete=True)
    set_server_state('created_virtualenv_example_project-0.1', delete=True)
    
    sudo('rm -rf /home/woven/workon-example_project')
    
    mkvirtualenv()
    deploy_project()
    
    activate()
示例#2
0
文件: fabfile.py 项目: rootart/woven
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)
示例#3
0
文件: fabfile.py 项目: rootart/woven
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')