blob: d35a5cb22fc9462d5120d124cf2ddeef5410c17a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
from zipfile import BadZipfile
import py.path
import pytest
import ez_setup
def test_download(tmpdir_cwd):
cwd = py.path.local()
ez_setup.download_setuptools()
res, = cwd.listdir()
assert res.basename.startswith('setuptools-')
assert res.basename.endswith('.zip')
# file should be bigger than 64k
assert res.size() > 2**16
def test_message_corrupted_setuptools(tmpdir_cwd):
cwd = py.path.local()
ez_setup.download_setuptools()
res, = cwd.listdir()
res.write('CORRUPT ME')
with pytest.raises(BadZipfile) as excinfo:
with ez_setup.archive_context(res.strpath):
pass
msg = ez_setup.MEANINGFUL_INVALID_ZIP_ERR_MSG.format(res.strpath)
assert msg in str(excinfo.value)
|