def test_create_calls_mkvirtualenv_with_python_version_and_domain( self, mock_subprocess, virtualenvs_folder): v = Virtualenv("domain.com", "2.7") v.create(nuke=False) args, kwargs = mock_subprocess.check_call.call_args command_list = args[0] bash_command = command_list[2] assert "mkvirtualenv --python=python2.7 domain.com" in bash_command
def test_nuke_option_deletes_virtualenv(self, mock_subprocess, virtualenvs_folder): v = Virtualenv("domain.com", "2.7") v.create(nuke=True) args, kwargs = mock_subprocess.check_call.call_args command_list = args[0] assert command_list[:2] == ["bash", "-c"] assert command_list[2].startswith( "source virtualenvwrapper.sh && rmvirtualenv domain.com")
def test_nuke_option_deletes_virtualenv(self, mock_subprocess, virtualenvs_folder): v = Virtualenv('domain.com', '2.7') v.create(nuke=True) args, kwargs = mock_subprocess.check_call.call_args command_list = args[0] assert command_list[:2] == ['bash', '-c'] assert command_list[2].startswith( 'source virtualenvwrapper.sh && rmvirtualenv domain.com')
def test_create_uses_bash_and_sources_virtualenvwrapper( self, mock_subprocess, virtualenvs_folder): v = Virtualenv("domain.com", "2.7") v.create(nuke=False) args, kwargs = mock_subprocess.check_call.call_args command_list = args[0] assert command_list[:2] == ["bash", "-c"] assert command_list[2].startswith( "source virtualenvwrapper.sh && mkvirtualenv")
def test_create_uses_bash_and_sources_virtualenvwrapper( self, mock_subprocess, virtualenvs_folder): v = Virtualenv('domain.com', '2.7') v.create(nuke=False) args, kwargs = mock_subprocess.check_call.call_args command_list = args[0] assert command_list[:2] == ['bash', '-c'] assert command_list[2].startswith( 'source virtualenvwrapper.sh && mkvirtualenv')
def __init__(self, domain, python_version): self.domain = domain self.python_version = python_version self.project_path = Path(f'~/{domain}').expanduser() self.virtualenv = Virtualenv(self.domain, self.python_version) self.wsgi_file_path = Path( f"/var/www/{domain.replace('.', '_')}_wsgi.py") self.webapp = Webapp(domain)
def test_gets_version(self, fake_home, virtualenvs_folder): running_python_version = ".".join(python_version().split(".")[:2]) v = Virtualenv("www.adomain.com", running_python_version) v.create(nuke=False) v.pip_install("aafigure==0.6") assert v.get_version("aafigure") == "0.6"
def __init__(self, domain, python_version): self.domain = domain self.python_version = python_version self.project_path = Path( '~/{domain}'.format(domain=domain)).expanduser() self.virtualenv = Virtualenv(self.domain, self.python_version) self.wsgi_file_path = Path('/var/www/{mangled_domain}_wsgi.py'.format( mangled_domain=domain.replace(".", "_"))) self.webapp = Webapp(domain)
def test_actually_installing_a_real_package(self, fake_home, virtualenvs_folder): v = Virtualenv("www.adomain.com", "2.7") v.create(nuke=False) v.pip_install("aafigure") subprocess.check_call( [str(v.path / "bin/python"), "-c" "import aafigure"])
def test_actually_installing_a_real_package(self, fake_home, virtualenvs_folder): v = Virtualenv('www.adomain.com', '2.7') v.create(nuke=False) v.pip_install('aafigure') subprocess.check_call( [str(v.path / 'bin/python'), '-c' 'import aafigure'])
def test_actually_installing_a_real_package(self, fake_home, virtualenvs_folder): running_python_version = ".".join(python_version().split(".")[:2]) v = Virtualenv("www.adomain.com", running_python_version) v.create(nuke=False) v.pip_install("aafigure") subprocess.check_call( [str(v.path / "bin/python"), "-c" "import aafigure"])
def test_install_pip_installs_each_package(self, mock_subprocess, virtualenvs_folder): v = Virtualenv("domain.com", "2.7") v.create(nuke=False) v.pip_install("package1 package2==1.1.2") args, kwargs = mock_subprocess.check_call.call_args_list[-1] command_list = args[0] pip_path = str(v.path / "bin/pip") assert command_list == [ pip_path, "install", "package1", "package2==1.1.2" ]
def test_install_pip_installs_each_package(self, mock_subprocess, virtualenvs_folder): v = Virtualenv('domain.com', '2.7') v.create(nuke=False) v.pip_install('package1 package2==1.1.2') args, kwargs = mock_subprocess.check_call.call_args_list[-1] command_list = args[0] pip_path = str(v.path / 'bin/pip') assert command_list == [ pip_path, 'install', 'package1', 'package2==1.1.2' ]
def test_virtualenv(self, fake_home, virtualenvs_folder): project = Project('mydomain.com', 'python.version') assert project.virtualenv == Virtualenv('mydomain.com', 'python.version')
def test_path(self, virtualenvs_folder): v = Virtualenv("domain.com", "python.version") assert v.path == Path(virtualenvs_folder) / "domain.com"
def test_path(self, virtualenvs_folder): v = Virtualenv('domain.com', 'python.version') assert v.path == Path(virtualenvs_folder) / 'domain.com'