|
3 | 3 | import xml.etree.ElementTree as ET |
4 | 4 |
|
5 | 5 | import pytest |
| 6 | +import requests |
6 | 7 |
|
7 | 8 | from mock import patch |
8 | 9 | from devpi_plumber.server import TestServer |
@@ -187,20 +188,28 @@ def test_reports_junit_xml(devpi, tmpdir): |
187 | 188 | _assert_junit_xml_content(junit_filename) |
188 | 189 |
|
189 | 190 |
|
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): |
192 | 192 |
|
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 |
197 | 198 |
|
198 | | - junit_filename = str(tmpdir.join('junit.xml')) |
| 199 | + monkeypatch.setenv('PIP_INDEX_URL', sdist_index) |
199 | 200 |
|
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]) |
204 | 213 |
|
205 | 214 | # check that the build failure shows up in the build output |
206 | 215 | assert 'No non-ascii 4 you!' in open(junit_filename).read() |
|
0 commit comments