8000 add semifunctional test for venv class · pythonanywhere/helper_scripts@7a109ba · GitHub
[go: up one dir, main page]

Skip to content

Commit 7a109ba

Browse files
committed
add semifunctional test for venv class
1 parent 7a60e54 commit 7a109ba

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

tests/test_django_project.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ def more_nested_submodule():
175175
class TestFindDjangoFiles:
176176

177177
def test_non_nested(self, fake_home, non_nested_submodule):
178-
179178
project = DjangoProject('mydomain.com', 'python.version')
180179
shutil.copytree(non_nested_submodule, project.project_path)
181180
expected_settings_path = project.project_path / 'myproject/settings.py'

tests/test_virtualenvs.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import pytest
12
from pathlib import Path
3+
import subprocess
4+
25
from pythonanywhere.virtualenvs import Virtualenv
36

47

@@ -9,7 +12,7 @@ def test_path(self, virtualenvs_folder):
912
assert v.path == Path(virtualenvs_folder) / 'domain.com'
1013

1114

12-
def test_create_uses_bash_and_sources_virtualenvwrapper(self, mock_subprocess):
15+
def test_create_uses_bash_and_sources_virtualenvwrapper(self, mock_subprocess, virtualenvs_folder):
1316
v = Virtualenv('domain.com', '2.7')
1417
v.create(nuke=False)
1518
args, kwargs = mock_subprocess.check_call.call_args
@@ -18,7 +21,7 @@ def test_create_uses_bash_and_sources_virtualenvwrapper(self, mock_subprocess):
1821
assert command_list[2].startswith('source virtualenvwrapper.sh && mkvirtualenv')
1922

2023

21-
def test_create_calls_mkvirtualenv_with_python_version_and_domain(self, mock_subprocess):
24+
def test_create_calls_mkvirtualenv_with_python_version_and_domain(self, mock_subprocess, virtualenvs_folder):
2225
v = Virtualenv('domain.com', '2.7')
2326
v.create(nuke=False)
2427
args, kwargs = mock_subprocess.check_call.call_args
@@ -36,7 +39,7 @@ def test_nuke_option_deletes_virtualenv(self, mock_subprocess, virtualenvs_folde
3639
assert command_list[2].startswith('source virtualenvwrapper.sh && rmvirtualenv domain.com')
3740

3841

39-
def test_install_pip_installs_packages(self, mock_subprocess):
42+
def test_install_pip_installs_packages(self, mock_subprocess, virtualenvs_folder):
4043
packages = 'package1 package2==1.1.2'
4144
v = Virtualenv('domain.com', '2.7')
4245
v.create(nuke=False)
@@ -47,3 +50,15 @@ def test_install_pip_installs_packages(self, mock_subprocess):
4750
assert command_list == [pip_path, 'install', packages]
4851

4952

53+
@pytest.mark.slowtest
54+
def test_actually_installing_a_real_package(self, fake_home, virtualenvs_folder):
55+
v = Virtualenv('www.adomain.com', '2.7')
56+
v.create(nuke=False)
57+
v.pip_install('aafigure')
58+
59+
subprocess.check_call([
60+
v.path / 'bin/python',
61+
'-c'
62+
'import aafigure'
63+
])
64+

0 commit comments

Comments
 (0)
0