mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 06:46:15 +00:00
9848862927
* 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.
90 lines
2.7 KiB
Python
90 lines
2.7 KiB
Python
"""Misc. tests that don't fit anywhere.
|
|
|
|
XXX: Try our best to reduce tests in this file.
|
|
"""
|
|
|
|
import os
|
|
|
|
import pytest
|
|
|
|
from pipenv.project import Project
|
|
from pipenv.utils.processes import subprocess_run
|
|
from pipenv.utils.shell import temp_environ
|
|
|
|
|
|
@pytest.mark.lock
|
|
@pytest.mark.deploy
|
|
def test_deploy_works(pipenv_instance_pypi):
|
|
|
|
with pipenv_instance_pypi(chdir=True) as p:
|
|
with open(p.pipfile_path, 'w') as f:
|
|
contents = """
|
|
[packages]
|
|
dataclasses-json = "==0.5.7"
|
|
flask = "==1.1.2"
|
|
|
|
[dev-packages]
|
|
pytest = "==4.6.9"
|
|
""".strip()
|
|
f.write(contents)
|
|
c = p.pipenv('install --verbose')
|
|
if c.returncode != 0:
|
|
assert c.stderr == '' or c.stderr is None
|
|
assert c.stdout == ''
|
|
assert c.returncode == 0
|
|
c = p.pipenv('lock')
|
|
assert c.returncode == 0
|
|
with open(p.pipfile_path, 'w') as f:
|
|
contents = """
|
|
[packages]
|
|
dataclasses-json = "==0.5.7"
|
|
""".strip()
|
|
f.write(contents)
|
|
|
|
c = p.pipenv('install --deploy')
|
|
assert c.returncode > 0
|
|
|
|
|
|
@pytest.mark.update
|
|
@pytest.mark.lock
|
|
def test_update_locks(pipenv_instance_private_pypi):
|
|
with pipenv_instance_private_pypi() as p:
|
|
c = p.pipenv('install jdcal==1.3')
|
|
assert c.returncode == 0
|
|
assert p.lockfile['default']['jdcal']['version'] == '==1.3'
|
|
with open(p.pipfile_path) as fh:
|
|
pipfile_contents = fh.read()
|
|
assert '==1.3' in pipfile_contents
|
|
pipfile_contents = pipfile_contents.replace('==1.3', '*')
|
|
with open(p.pipfile_path, 'w') as fh:
|
|
fh.write(pipfile_contents)
|
|
c = p.pipenv('update jdcal')
|
|
assert c.returncode == 0
|
|
assert p.lockfile['default']['jdcal']['version'] == '==1.4'
|
|
c = p.pipenv('run pip freeze')
|
|
assert c.returncode == 0
|
|
lines = c.stdout.splitlines()
|
|
assert 'jdcal==1.4' in [l.strip() for l in lines]
|
|
|
|
|
|
@pytest.mark.project
|
|
@pytest.mark.proper_names
|
|
def test_proper_names_unmanaged_virtualenv(pipenv_instance_pypi):
|
|
with pipenv_instance_pypi(chdir=True):
|
|
c = subprocess_run(['python', '-m', 'virtualenv', '.venv'])
|
|
assert c.returncode == 0
|
|
project = Project()
|
|
assert project.proper_names == []
|
|
|
|
|
|
@pytest.mark.cli
|
|
def test_directory_with_leading_dash(raw_venv, pipenv_instance_pypi):
|
|
with temp_environ():
|
|
with pipenv_instance_pypi(chdir=True, venv_in_project=False, name="-project-with-dash") as p:
|
|
c = p.pipenv('run pip freeze')
|
|
assert c.returncode == 0
|
|
c = p.pipenv('--venv')
|
|
assert c.returncode == 0
|
|
venv_path = c.stdout.strip()
|
|
assert os.path.isdir(venv_path)
|