1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
pip/news/6a2297c8-25c3-4c79-b856-03f0184af36f.trivial.rst
Jon Dufresne bec53e0388 Fix unreachable code in tests/unit/test_network_utils.py
Examining the pytest.raises excinfo object should be done outside the
with statement block. Previously, the raised exception prevented the
assert from being executed.

Per the docs:
https://docs.pytest.org/en/latest/how-to/assert.html#assertions-about-expected-exceptions

The exception is the "value" attribute, not "info".

mypy also caught this mistake:

    tests/unit/test_network_utils.py:23: error:
    "ExceptionInfo[NetworkConnectionError]" has no attribute "info"  [attr-defined]
                assert str(exc.info) == (
2021-09-20 20:58:06 -07:00

0 lines
ReStructuredText