Files
pipenv/tests/unit/test_utils_windows_executable.py
T
Dan Ryan e03878d7c7 Add news entry and fix lockfile
- Drop pytest-tap
- Update azure pipelines config
- Borrow ramdisk configuration from pip
- Fix pyinstaller ref for python 2
- Add 0-minute timeout and add github workflow
- Add skip for pywin32
- Scale down to `-n auto` to reduce race conditions on windows
- Skip pywin32 on python 3.8 as the relevant dependencies aren't
  compatible
- Use default pip exists action = ignore to work around VCS race
  condition
- Create local temp directory to avoid crossing drive letter boundary on
  azure during CI runs
- Monkeypatch click windows console detection to return False in CI

Signed-off-by: Dan Ryan <dan.ryan@canonical.com>
2020-04-10 12:14:06 -04:00

32 lines
800 B
Python

import os
import mock
import pytest
from pipenv import utils
# This module is run only on Windows.
pytestmark = pytest.mark.skipif(
os.name != 'nt',
reason="only relevant on windows",
)
@pytest.mark.utils
@mock.patch('os.path.isfile')
@mock.patch('pipenv.utils.find_executable')
def test_find_windows_executable(mocked_find_executable, mocked_isfile):
mocked_isfile.return_value = False
mocked_find_executable.return_value = None
found = utils.find_windows_executable('fake/path', 'python')
assert found is None
assert mocked_isfile.call_count > 1
calls = [mock.call('fake\\path\\python')] + [
mock.call('fake\\path\\python{0}'.format(ext.lower()))
for ext in os.environ['PATHEXT'].split(';')
]
assert mocked_isfile.mock_calls == calls