Files
pipenv/tests/integration/test_windows.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

84 lines
2.3 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
import pytest
from pipenv._compat import Path
# This module is run only on Windows.
pytestmark = pytest.mark.skipif(os.name != 'nt', reason="only relevant on windows")
@pytest.mark.project
def test_case_changes_windows(PipenvInstance):
"""Test project matching for case changes on Windows.
"""
with PipenvInstance(chdir=True) as p:
c = p.pipenv('install pytz')
assert c.return_code == 0
# Canonical venv location.
c = p.pipenv('--venv')
assert c.return_code == 0
virtualenv_location = c.out.strip()
# Dance around to change the casing of the project directory.
target = p.path.upper()
if target == p.path:
target = p.path.lower()
os.chdir('..')
os.chdir(target)
assert os.path.abspath(os.curdir) != p.path
# Ensure the incorrectly-cased project can find the correct venv.
c = p.pipenv('--venv')
assert c.return_code == 0
assert c.out.strip().lower() == virtualenv_location.lower()
@pytest.mark.files
@pytest.mark.local
def test_local_path_windows(PipenvInstance):
whl = (
Path(__file__).parent.parent
.joinpath('pypi', 'six', 'six-1.11.0-py2.py3-none-any.whl')
)
try:
whl = whl.resolve()
except OSError:
whl = whl.absolute()
with PipenvInstance(chdir=True) as p:
c = p.pipenv('install "{0}"'.format(whl))
assert c.return_code == 0
@pytest.mark.local
@pytest.mark.files
def test_local_path_windows_forward_slash(PipenvInstance):
whl = (
Path(__file__).parent.parent
.joinpath('pypi', 'six', 'six-1.11.0-py2.py3-none-any.whl')
)
try:
whl = whl.resolve()
except OSError:
whl = whl.absolute()
with PipenvInstance(chdir=True) as p:
c = p.pipenv('install "{0}"'.format(whl.as_posix()))
assert c.return_code == 0
@pytest.mark.cli
def test_pipenv_clean_windows(PipenvInstance):
with PipenvInstance(chdir=True) as p:
c = p.pipenv('install requests')
assert c.return_code == 0
c = p.pipenv('run pip install click')
assert c.return_code == 0
c = p.pipenv('clean --dry-run')
assert c.return_code == 0
assert 'click' in c.out.strip()