Remove pytest-pypi server from usage in tests

This commit is contained in:
Oz Tiram
2022-12-28 15:45:41 +01:00
parent cff5620a47
commit abcb3e2df4
2 changed files with 12 additions and 10 deletions
-6
View File
@@ -26,10 +26,6 @@ from pipenv.vendor.vistir.path import (
create_tracked_tempdir, handle_remove_readonly
)
from pytest_pypi.app import prepare_fixtures
from pytest_pypi.app import prepare_packages as prepare_pypi_packages
import pypiserver
log = logging.getLogger(__name__)
warnings.simplefilter("default", category=ResourceWarning)
cli_runner = CliRunner(mix_stderr=False)
@@ -98,8 +94,6 @@ def check_for_mercurial():
TESTS_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PYPI_VENDOR_DIR = os.path.join(TESTS_ROOT, 'pypi')
WE_HAVE_HG = check_for_mercurial()
prepare_fixtures(os.path.join(PYPI_VENDOR_DIR, "fixtures"))
prepare_pypi_packages(PYPI_VENDOR_DIR)
def pytest_runtest_setup(item):
+12 -4
View File
@@ -4,7 +4,6 @@ from pathlib import Path
import pytest
import pytest_pypi.app
from flaky import flaky
from pipenv.vendor.vistir.misc import to_text
from pipenv.utils.shell import temp_environ
@@ -64,12 +63,21 @@ def test_lock_includes_hashes_for_all_platforms(pipenv_instance_private_pypi):
""" Locking should include hashes for *all* platforms, not just the
platform we're running lock on. """
releases = pytest_pypi.app.packages['yarl'].releases
#releases = pytest_pypi.app.packages['yarl'].releases
releases = {'yarl-1.3.0-cp35-cp35m-manylinux1_x86_64.whl': '3890ab952d508523ef4881457c4099056546593fa05e93da84c7250516e632eb',
'yarl-1.3.0-cp35-cp35m-win_amd64.whl': 'b25de84a8c20540531526dfbb0e2d2b648c13fd5dd126728c496d7c3fea33310',
'yarl-1.3.0-cp36-cp36m-manylinux1_x86_64.whl': '5badb97dd0abf26623a9982cd448ff12cb39b8e4c94032ccdedf22ce01a64842',
'yarl-1.3.0-cp36-cp36m-win_amd64.whl': 'c6e341f5a6562af74ba55205dbd56d248daf1b5748ec48a0200ba227bb9e33f4',
'yarl-1.3.0-cp37-cp37m-win_amd64.whl': '73f447d11b530d860ca1e6b582f947688286ad16ca42256413083d13f260b7a0',
'yarl-1.3.0.tar.gz': '024ecdc12bc02b321bc66b41327f930d1c2c543fa9a561b39861da9388ba7aa9',
}
def get_hash(release_name):
# Convert a specific filename to a hash like what would show up in a Pipfile.lock.
# For example:
# 'yarl-1.3.0-cp35-cp35m-manylinux1_x86_64.whl' -> 'sha256:3890ab952d508523ef4881457c4099056546593fa05e93da84c7250516e632eb'
return f"sha256:{releases[release_name].hash}"
return f"sha256:{releases[release_name]}"
with pipenv_instance_private_pypi() as p:
with open(p.pipfile_path, 'w') as f:
@@ -731,4 +739,4 @@ dataclasses-json = {extras = ["dev"], version = "==0.5.7"}
assert c.returncode == 0
assert "dataclasses-json" in p.pipfile["packages"]
assert "dataclasses-json" in p.lockfile["default"]
assert "markers" not in p.lockfile["default"]["dataclasses-json"]
assert "markers" not in p.lockfile["default"]["dataclasses-json"]