summaryrefslogtreecommitdiff
path: root/tests/test_virtualenv.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_virtualenv.py')
-rw-r--r--tests/test_virtualenv.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/tests/test_virtualenv.py b/tests/test_virtualenv.py
index 8c1d05b..0356a38 100644
--- a/tests/test_virtualenv.py
+++ b/tests/test_virtualenv.py
@@ -1,5 +1,9 @@
import virtualenv
import optparse
+import os
+import shutil
+import sys
+import tempfile
from mock import patch, Mock
@@ -22,7 +26,7 @@ def test_resolve_interpreter_with_absolute_path(mock_exists):
@patch('os.path.exists')
-def test_resolve_intepreter_with_nonexistant_interpreter(mock_exists):
+def test_resolve_interpreter_with_nonexistent_interpreter(mock_exists):
"""Should exit when with absolute path if not exists"""
mock_exists.return_value = False
@@ -36,7 +40,7 @@ def test_resolve_intepreter_with_nonexistant_interpreter(mock_exists):
@patch('os.path.exists')
-def test_resolve_intepreter_with_invalid_interpreter(mock_exists):
+def test_resolve_interpreter_with_invalid_interpreter(mock_exists):
"""Should exit when with absolute path if not exists"""
mock_exists.return_value = True
virtualenv.is_executable = Mock(return_value=False)
@@ -92,3 +96,25 @@ def test_cop_update_defaults_with_store_false():
defaults = {}
cop.update_defaults(defaults)
assert defaults == {'system_site_packages': 0}
+
+def test_install_python_symlinks():
+ """Should create the right symlinks in bin_dir"""
+ tmp_virtualenv = tempfile.mkdtemp()
+ try:
+ home_dir, lib_dir, inc_dir, bin_dir = \
+ virtualenv.path_locations(tmp_virtualenv)
+ virtualenv.install_python(home_dir, lib_dir, inc_dir, bin_dir, False,
+ False)
+
+ py_exe_no_version = 'python'
+ py_exe_version_major = 'python%s' % sys.version_info[0]
+ py_exe_version_major_minor = 'python%s.%s' % (
+ sys.version_info[0], sys.version_info[1])
+ required_executables = [ py_exe_no_version, py_exe_version_major,
+ py_exe_version_major_minor ]
+
+ for pth in required_executables:
+ assert os.path.exists(os.path.join(bin_dir, pth)), ("%s should "
+ "exist in bin_dir" % pth)
+ finally:
+ shutil.rmtree(tmp_virtualenv)