8000 virtualenvs now compare · pythonanywhere/helper_scripts@739176f · GitHub
[go: up one dir, main page]

Skip to content

Commit 739176f

Browse files
committed
virtualenvs now compare
1 parent 2e28a8e commit 739176f

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

pythonanywhere/virtualenvs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ def __init__(self, domain, python_version):
1212
self.python_version = python_version
1313
self.path = Path(os.environ['WORKON_HOME']) / domain
1414

15+
def __eq__(self, other):
16+
return self.domain == other.domain and self.python_version == other.python_version
1517

1618
def create(self, nuke):
1719
pass

tests/test_project.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pythonanywhere.project import Project
66
from pythonanywhere.exceptions import SanityException
77
from pythonanywhere.api import Webapp
8-
from pythonanywhere.virtualenvs import virtualenv_path
8+
from pythonanywhere.virtualenvs import Virtualenv
99

1010

1111

@@ -31,9 +31,9 @@ def test_webapp(self, fake_home):
3131
assert project.webapp == Webapp('mydomain.com')
3232

3333

34-
def test_virtualenv_path(self, fake_home):
34+
def test_virtualenv(self, fake_home):
3535
project = Project('mydomain.com', 'python.version')
36-
assert project.virtualenv_path == virtualenv_path('mydomain.com')
36+
assert project.virtualenv == Virtualenv('mydomain.com', 'python.version')
3737

3838

3939

tests/test_virtualenvs.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ def test_create_pip_installs_packages(self, mock_subprocess):
3232
assert command_list[2].endswith('pip install package1 package2==1.1.2')
3333

3434

35-
def test_create_returns_virtualenv_path(self, mock_subprocess, virtualenvs_folder):
36-
response = create_virtualenv('domain.com', '2.7', 'django', nuke=False)
37-
assert response == virtualenvs_folder / 'domain.com'
38-
39-
4035
def test_create_nuke_option_deletes_virtualenv_first(self, mock_subprocess, virtualenvs_folder):
4136
create_virtualenv('domain.com', '2.7', 'django', nuke=True)
4237
args, kwargs = mock_subprocess.check_call.call_args

0 commit comments

Comments
 (0)
0