Skip to content

Commit ed73e77

Browse files
authored
Merge pull request #225 from blue-yonder/fix-tests
Fix tests
2 parents 0253a8f + bbcace5 commit ed73e77

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ pytest-cov
66
pytest-mock
77
mock
88
devpi-plumber[test]>=0.4.3
9+
legacy-cgi

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ lazy==1.6
8989
# via
9090
# devpi-common
9191
# devpi-server
92+
legacy-cgi==2.6.4
93+
# via -r requirements.in
9294
mock==5.2.0
9395
# via -r requirements.in
9496
nh3==0.2.21

tests/test_cli.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import xml.etree.ElementTree as ET
44

55
import pytest
6+
import requests
67

78
from mock import patch
89
from devpi_plumber.server import TestServer
@@ -187,20 +188,28 @@ def test_reports_junit_xml(devpi, tmpdir):
187188
_assert_junit_xml_content(junit_filename)
188189

189190

190-
def test_handles_non_ascii_build_output(devpi, tmpdir, monkeypatch):
191-
monkeypatch.setenv('PIP_INDEX_URL', devpi.url + '/' + PURE_INDEX)
191+
def test_handles_non_ascii_build_output(tmpdir, monkeypatch):
192192

193-
with DevpiClient(devpi.server_url + '/' + PURE_INDEX,
194-
USER,
195-
PASSWORD) as client:
196-
client.upload('tests/fixture/non-ascii_package/dist/non-ascii-package-0.1.dev1.tar.gz')
193+
with TestServer(USERS, {
194+
PURE_INDEX: {'bases': '/root/pypi'},
195+
INDEX: {'bases': ''},
196+
}) as devpi:
197+
sdist_index = devpi.url + '/' + PURE_INDEX
197198

198-
junit_filename = str(tmpdir.join('junit.xml'))
199+
monkeypatch.setenv('PIP_INDEX_URL', sdist_index)
199200

200-
# our main assertion is that the main does not fail
201-
main(['tests/fixture/sample_non-ascii.txt', devpi.url + '/' + INDEX,
202-
'--user={}'.format(USER),
203-
'--password={}'.format(PASSWORD), '--junit-xml', junit_filename])
201+
# trigger retrieval of setuptools from upstream as that can take forever
202+
requests.get(sdist_index + '/+simple/setuptools/', timeout=300).raise_for_status()
203+
204+
with DevpiClient(sdist_index, USER, PASSWORD) as client:
205+
client.upload('tests/fixture/non-ascii_package/dist/non-ascii-package-0.1.dev1.tar.gz')
206+
207+
junit_filename = str(tmpdir.join('junit.xml'))
208+
209+
# our main assertion is that the main does not fail
210+
main(['tests/fixture/sample_non-ascii.txt', devpi.url + '/' + INDEX,
211+
'--user={}'.format(USER),
212+
'--password={}'.format(PASSWORD), '--junit-xml', junit_filename])
204213

205214
# check that the build failure shows up in the build output
206215
assert 'No non-ascii 4 you!' in open(junit_filename).read()

0 commit comments

Comments
 (0)