10000 project virtualenv_path -> virtualenv.path · pythonanywhere/helper_scripts@dd84b1a · GitHub
[go: up one dir, main page]

Skip to content

Commit dd84b1a

Browse files
committed
project virtualenv_path -> virtualenv.path
1 parent 739176f commit dd84b1a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

pythonanywhere/project.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pathlib import Path
22
from pythonanywhere.api import Webapp
33
from pythonanywhere.exceptions import SanityException
4-
from pythonanywhere.virtualenvs import Virtualenv, virtualenv_path
4+
from pythonanywhere.virtualenvs import Virtualenv
55

66

77
class Project:
@@ -10,7 +10,6 @@ def __init__(self, domain, python_version):
1010
self.python_version = python_version
1111
self.project_path = Path(f'~/{domain}').expanduser()
1212
self.virtualenv = Virtualenv(self.domain, self.python_version)
13-
self.virtualenv_path = virtualenv_path(domain)
1413
self.wsgi_file_path = Path(f'/var/www/{domain.replace(".", "_")}_wsgi.py')
1514
self.webapp = Webapp(domain)
1615

@@ -19,7 +18,7 @@ def sanity_checks(self, nuke):
1918
self.webapp.sanity_checks(nuke=nuke)
2019
if nuke:
2120
return
22-
if self.virtualenv_path.exists():
21+
if self.virtualenv.path.exists():
2322
raise SanityException(f'You already have a virtualenv for {self.domain}.\n\nUse the --nuke option if you want to replace it.')
2423
if self.project_path.exists():
2524
raise SanityException(f'You already have a project folder at {self.project_path}.\n\nUse the --nuke option if you want to replace it.')
@@ -30,7 +29,7 @@ def create_virtualenv(self, nuke):
3029

3130

3231
def create_webapp(self, nuke):
33-
self.webapp.create(self.python_version, self.virtualenv_path, self.project_path, nuke=nuke)
32+
self.webapp.create(self.python_version, self.virtualenv.path, self.project_path, nuke=nuke)
3433

3534

3635
def add_static_file_mappings(self):

tests/test_project.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_calls_webapp_sanity_checks(self, fake_home):
4949
def test_raises_if_virtualenv_exists(self, fake_home, virtualenvs_folder):
5050
project = Project('mydomain.com', 'python.version')
5151
project.webapp.sanity_checks = Mock()
52-
project.virtualenv_path.mkdir()
52+
project.virtualenv.path.mkdir()
5353

5454
with pytest.raises(SanityException) as e:
5555
project.sanity_checks(nuke=False)
@@ -75,7 +75,7 @@ def test_nuke_option_overrides_directory_checks(self, fake_home, virtualenvs_fol
7575
project = Project('mydomain.com', 'python.version')
7676
project.webapp.sanity_checks = Mock()
7777
project.project_path.mkdir()
78-
project.virtualenv_path.mkdir()
78+
project.virtualenv.path.mkdir()
7979

8080
project.sanity_checks(nuke=True) # should not raise
8181

@@ -102,7 +102,7 @@ def test_calls_webapp_create(self):
102102

103103
project.create_webapp(nuke='nuke option')
104104
assert project.webapp.create.call_args == call(
105-
'python.version', project.virtualenv_path, project.project_path, nuke='nuke option'
105+
'python.version', project.virtualenv.path, project.project_path, nuke='nuke option'
106106
)
107107

108108

0 commit comments

Comments
 (0)
0