diff options
Diffstat (limited to 'test_ez_setup.py')
-rw-r--r-- | test_ez_setup.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test_ez_setup.py b/test_ez_setup.py index 49a578ea..d35a5cb2 100644 --- a/test_ez_setup.py +++ b/test_ez_setup.py @@ -1,5 +1,9 @@ +from zipfile import BadZipfile + import py.path +import pytest + import ez_setup @@ -11,3 +15,15 @@ def test_download(tmpdir_cwd): 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) |