1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
pip/tests/lib
Christopher Hunt 69143848b0
Make WHEEL file errors more explicit (#7529)
* Raise exception on exception in finding wheel dist

We plan to replace this code with direct extraction from a zip, so no
point catching anything more precise.

* Raise exception if no dist is found in wheel_version
* Catch file read errors when reading WHEEL

get_metadata delegates to the underlying implementation which tries
to locate and read the file, throwing an IOError (Python 2) or OSError
subclass on any errors.

Since the new explicit test checks the same case as brokenwheel in
test_wheel_version we remove the redundant test.

* Check for WHEEL decoding errors explicitly

This was the last error that could be thrown by get_metadata, so we can
also remove the catch-all except block.

* Move WHEEL parsing outside try...except

This API does not raise an exception, but returns any errors on the
message object itself. We are preserving the original behavior, and can
decide later whether to start warning or raising our own exception.

* Raise explicit error if Wheel-Version is missing

`email.message.Message.__getitem__` returns None on missing values, so
we have to check for ourselves explicitly.

* Raise explicit exception on failure to parse Wheel-Version

This is also the last exception that can be raised, so we remove
`except Exception`.

* Remove dead code

Since wheel_version never returns None, this exception will never be
raised.
2019-12-31 23:17:41 +08:00
..
__init__.py Only check for .dist-info directories at the top-level 2019-12-28 15:49:08 -05:00
certs.py Add test helpers for HTTP(S) server and certs 2019-11-03 17:05:52 -05:00
configuration_helpers.py Reset os.environ while preserving the original mapping. 2019-02-02 17:19:20 -08:00
filesystem.py Ignore errors copying socket files for source installs (in Python 3). (#6844) 2019-08-21 02:19:02 -07:00
git_submodule_helpers.py Remove unnecessary expect_error. 2019-08-10 22:39:57 -04:00
local_repos.py Don't pass "/trunk" when calling local_checkout() with svn. 2019-09-21 03:29:34 -07:00
options_helpers.py Only import a Command class when it is actually needed. 2019-07-26 23:30:26 -04:00
path.py Make WHEEL file errors more explicit (#7529) 2019-12-31 23:17:41 +08:00
requests_mocks.py Move helper mock classes to dedicated module 2019-12-04 18:30:21 -05:00
scripttest.py Use Flake8 on the test of pip's Python files 2014-01-28 19:47:58 -05:00
server.py Add mock_server documentation 2019-11-17 16:12:17 -05:00
test_lib.py Assert that expect_error script invocations return non-zero. 2019-08-12 16:27:25 -04:00
venv.py Align interface of tests.lib.path.Path.mkdir with pathlib.Path.mkdir. 2019-10-06 21:55:10 -04:00
yaml_helpers.py Add support for YAML based test files (#4637) 2017-08-07 12:03:43 -04:00