Files
pipenv/tests/integration/test_windows.py
T
Matt Davis 9848862927 Convert test runner to use pypiserver package as standalone process (#5284)
* Check point progress on moving tests to pypiserver.

* Allow other indexes to mimic the pypi json API for package hashes.

* Fix these tests that run on lower python versions only.

* Try adding the pypiserver to the github actions to only run once.

* Expand the scope of fixtures for pypiserver.

* try to accomedate microsoft runner.

* Windows networking troubles.

* Remove running as a background job.

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to introduce pypi as the root index because setuptools-scm is not in our pypi artifacts.

* see if the windows tests run faster (and the other tests) by supplying waitress.

* Only use waitress on windows because the others are fast on the default.  Fix requests pollution.

* Supply a suitable Pipfile instead for these two failing tests.

* More requests resolver cross test contamination cleanup.

* remove problematic tests because even on my version of python 3.8.12 this does not work due to AttributeError: 'HTMLParser' object has no attribute 'unescape'

* fix mirror install test.

* Fix Pipfile.

* Fix Pipfile for real

* Fix tests

* Cleanup test naming and more test enhancements.

* Save this optimization for a subsequent PR.

* Cleanup the TemporaryDirectory between tests.

* resolve merge conflict.

* Cleanup path initalization -- it hsould always be a TemporaryDirectory for tests that gets cleanedup.

* Cleanup path initalization -- it hsould always be a TemporaryDirectory for tests that gets cleanedup.

* tableflip on those requests tests that read the setup metadata in reqlib from other tests.

* Update developer documentation for running tests.

* add news fragment.

* Try gunicorn perfoormance for linux/mac

* Only use gunicorn on linux based on the results of last run.
2022-09-05 10:19:12 -04:00

89 lines
2.6 KiB
Python

import os
from pathlib import Path
import pytest
from pipenv.utils.processes import subprocess_run
# 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(pipenv_instance_pypi):
"""Test project matching for case changes on Windows.
"""
with pipenv_instance_pypi(chdir=True) as p:
c = p.pipenv('install pytz')
assert c.returncode == 0
# Canonical venv location.
c = p.pipenv('--venv')
assert c.returncode == 0
virtualenv_location = c.stdout.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.returncode == 0
assert c.stdout.strip().lower() == virtualenv_location.lower()
@pytest.mark.files
@pytest.mark.local
def test_local_path_windows(pipenv_instance_pypi):
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 pipenv_instance_pypi(chdir=True) as p:
c = p.pipenv(f'install "{whl}"')
assert c.returncode == 0
@pytest.mark.local
@pytest.mark.files
def test_local_path_windows_forward_slash(pipenv_instance_pypi):
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 pipenv_instance_pypi(chdir=True) as p:
c = p.pipenv(f'install "{whl.as_posix()}"')
assert c.returncode == 0
@pytest.mark.cli
def test_pipenv_clean_windows(pipenv_instance_pypi):
with pipenv_instance_pypi(chdir=True) as p:
c = p.pipenv('install dataclasses-json')
assert c.returncode == 0
c = p.pipenv(f'run pip install -i {p.index_url} click')
assert c.returncode == 0
c = p.pipenv('clean --dry-run')
assert c.returncode == 0
assert 'click' in c.stdout.strip()
@pytest.mark.cli
def test_pipenv_run_with_special_chars_windows(pipenv_instance_pypi):
with pipenv_instance_pypi():
c = subprocess_run(["pipenv", "run", "echo", "[3-1]"])
assert c.returncode == 0, c.stderr