From 2393ca9dc44af9c1a3ed755028517d801312739c Mon Sep 17 00:00:00 2001 From: Matthias Bach Date: Mon, 15 Dec 2025 09:30:41 +0100 Subject: [PATCH 1/2] Improve compatibility of tests with newer version of pip With the build isolation applied by newer versions of pip, tests that build a test artifact from the test server they spin up need to be able to pull setuptools from that. --- tests/test_cli.py | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 53e1dff..9ee7cf4 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -3,6 +3,7 @@ import xml.etree.ElementTree as ET import pytest +import requests from mock import patch from devpi_plumber.server import TestServer @@ -187,20 +188,28 @@ def test_reports_junit_xml(devpi, tmpdir): _assert_junit_xml_content(junit_filename) -def test_handles_non_ascii_build_output(devpi, tmpdir, monkeypatch): - monkeypatch.setenv('PIP_INDEX_URL', devpi.url + '/' + PURE_INDEX) +def test_handles_non_ascii_build_output(tmpdir, monkeypatch): - with DevpiClient(devpi.server_url + '/' + PURE_INDEX, - USER, - PASSWORD) as client: - client.upload('tests/fixture/non-ascii_package/dist/non-ascii-package-0.1.dev1.tar.gz') + with TestServer(USERS, { + PURE_INDEX: {'bases': '/root/pypi'}, + INDEX: {'bases': ''}, + }) as devpi: + sdist_index = devpi.url + '/' + PURE_INDEX - junit_filename = str(tmpdir.join('junit.xml')) + monkeypatch.setenv('PIP_INDEX_URL', sdist_index) - # our main assertion is that the main does not fail - main(['tests/fixture/sample_non-ascii.txt', devpi.url + '/' + INDEX, - '--user={}'.format(USER), - '--password={}'.format(PASSWORD), '--junit-xml', junit_filename]) + # trigger retrieval of setuptools from upstream as that can take forever + requests.get(sdist_index + '/+simple/setuptools/', timeout=300).raise_for_status() + + with DevpiClient(sdist_index, USER, PASSWORD) as client: + client.upload('tests/fixture/non-ascii_package/dist/non-ascii-package-0.1.dev1.tar.gz') + + junit_filename = str(tmpdir.join('junit.xml')) + + # our main assertion is that the main does not fail + main(['tests/fixture/sample_non-ascii.txt', devpi.url + '/' + INDEX, + '--user={}'.format(USER), + '--password={}'.format(PASSWORD), '--junit-xml', junit_filename]) # check that the build failure shows up in the build output assert 'No non-ascii 4 you!' in open(junit_filename).read() From bbcace594deac3cb4d47ab347401687f51e05ae1 Mon Sep 17 00:00:00 2001 From: Matthias Bach Date: Fri, 19 Dec 2025 17:25:18 +0100 Subject: [PATCH 2/2] Add missing test dependency for Python 3.13 Python 3.13 no longer ships the cgi module. But as we are pinning dependencies on the oldest Python version we support, the corresponding legacy module is not pulled in automatically. So we need to declare it explicitly for the tests for Python 3.13 to have it available. --- requirements.in | 1 + requirements.txt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/requirements.in b/requirements.in index 6c10318..07a29be 100644 --- a/requirements.in +++ b/requirements.in @@ -6,3 +6,4 @@ pytest-cov pytest-mock mock devpi-plumber[test]>=0.4.3 +legacy-cgi diff --git a/requirements.txt b/requirements.txt index a10c97b..5c1c62e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -89,6 +89,8 @@ lazy==1.6 # via # devpi-common # devpi-server +legacy-cgi==2.6.4 + # via -r requirements.in mock==5.2.0 # via -r requirements.in nh3==0.2.21