@@ -15,6 +15,35 @@ def test_version():
15
15
assert virtualenv .virtualenv_version , "Should have version"
16
16
17
17
18
+ @patch ('distutils.spawn.find_executable' )
19
+ @patch ('virtualenv.is_executable' , return_value = True )
20
+ @patch ('virtualenv.get_installed_pythons' )
21
+ @patch ('os.path.exists' , return_value = True )
22
+ @patch ('os.path.abspath' )
23
+ def test_resolve_interpreter_with_installed_python (mock_abspath , mock_exists ,
24
+ mock_get_installed_pythons , mock_is_executable , mock_find_executable ):
25
+ test_tag = 'foo'
26
+ test_path = '/path/to/foo/python.exe'
27
+ test_abs_path = 'some-abs-path'
28
+ test_found_path = 'some-found-path'
29
+ mock_get_installed_pythons .return_value = {
30
+ test_tag : test_path ,
31
+ test_tag + '2' : test_path + '2' }
32
+ mock_abspath .return_value = test_abs_path
33
+ mock_find_executable .return_value = test_found_path
34
+
35
+ exe = virtualenv .resolve_interpreter ('foo' )
36
+
37
+ assert exe == test_found_path , \
38
+ "installed python should be accessible by key"
39
+
40
+ mock_get_installed_pythons .assert_called_once_with ()
41
+ mock_abspath .assert_called_once_with (test_path )
42
+ mock_find_executable .assert_called_once_with (test_path )
43
+ mock_exists .assert_called_once_with (test_found_path )
44
+ mock_is_executable .assert_called_once_with (test_found_path )
45
+
46
+
18
47
@patch ('virtualenv.is_executable' , return_value = True )
19
48
@patch ('virtualenv.get_installed_pythons' , return_value = {'foo' : 'bar' })
20
49
@patch ('os.path.exists' , return_value = True )
0 commit comments