File: test_http_client_exception_mapping.py

package info (click to toggle)
awscli 2.31.35-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 156,692 kB
  • sloc: python: 213,816; xml: 14,082; makefile: 189; sh: 178; javascript: 8
file content (20 lines) | stat: -rw-r--r-- 630 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import pytest
from botocore import exceptions as botocore_exceptions
from botocore.vendored.requests.packages.urllib3 import (
    exceptions as urllib3_exceptions,
)


@pytest.mark.parametrize(
    "new_exception, old_exception",
    (
        (
            botocore_exceptions.ReadTimeoutError,
            urllib3_exceptions.ReadTimeoutError,
        ),
    ),
)
def test_http_client_exception_mapping(new_exception, old_exception):
    # assert that the new exception can still be caught by the old vendored one
    with pytest.raises(old_exception):
        raise new_exception(endpoint_url=None, proxy_url=None, error=None)