From 4084296f3fa8776e3fbd6fa86bc267048b21f554 Mon Sep 17 00:00:00 2001 From: Lukasz Langa Date: Thu, 22 Dec 2016 15:54:20 -0800 Subject: [PATCH] Exclude boto from tests due to broken Liskov Substitution Principle Starting with python/mypy#2521 mypy is performing stricter function signature checks. This makes the stubs diverge from the actual implementation but makes the stubs internally consistent. Since this is an actual typing issue in the base implementation, we need to defer to the original authors to fix it. Sadly, in this case the breakage is rather fundamental and unlikely to get fixed by upstream. Consider: ``` class AWSAuthConnection(object): def make_request(self, method, path, headers=None, data='', host=None, auth_path=None, sender=None, override_num_retries=None, params=None, retry_handler=None): ... class AWSQueryConnection(AWSAuthConnection): def make_request(self, action, params=None, path='/', verb='GET'): ... ``` Hence, until we have a workaround for the error produced by Mypy, we're excluding those stubs from being tested against. --- tests/mypy_blacklist.txt | 1 + third_party/2and3/boto/connection.pyi | 2 +- third_party/2and3/boto/s3/connection.pyi | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/mypy_blacklist.txt b/tests/mypy_blacklist.txt index e69de29bb..040998a5e 100644 --- a/tests/mypy_blacklist.txt +++ b/tests/mypy_blacklist.txt @@ -0,0 +1 @@ +third_party/2and3/boto/.* diff --git a/third_party/2and3/boto/connection.pyi b/third_party/2and3/boto/connection.pyi index 584716a61..287dce6f2 100644 --- a/third_party/2and3/boto/connection.pyi +++ b/third_party/2and3/boto/connection.pyi @@ -111,7 +111,7 @@ class AWSQueryConnection(AWSAuthConnection): ResponseError = ... # type: Any def __init__(self, aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., is_secure: bool = ..., port: Optional[Any] = ..., proxy: Optional[Any] = ..., proxy_port: Optional[Any] = ..., proxy_user: Optional[Any] = ..., proxy_pass: Optional[Any] = ..., host: Optional[Any] = ..., debug: int = ..., https_connection_factory: Optional[Any] = ..., path: str = ..., security_token: Optional[Any] = ..., validate_certs: bool = ..., profile_name: Optional[Any] = ..., provider: str = ...) -> None: ... def get_utf8_value(self, value): ... - def make_request(self, action, params: Optional[Any] = ..., path: str = ..., verb: str = ..., *args, **kwargs): ... + def make_request(self, action, params: Optional[Any] = ..., path: str = ..., verb: str = ..., *args, **kwargs): ... # FIXME: signature incompatible with base class def build_list_params(self, params, items, label): ... def build_complex_list_params(self, params, items, label, names): ... def get_list(self, action, params, markers, path: str = ..., parent: Optional[Any] = ..., verb: str = ...): ... diff --git a/third_party/2and3/boto/s3/connection.pyi b/third_party/2and3/boto/s3/connection.pyi index b9df2cbf1..edfbf3460 100644 --- a/third_party/2and3/boto/s3/connection.pyi +++ b/third_party/2and3/boto/s3/connection.pyi @@ -4,7 +4,7 @@ from .bucket import Bucket -from typing import Any, Optional, Text, Type +from typing import Any, Dict, Optional, Text, Type from boto.connection import AWSAuthConnection from boto.exception import BotoClientError @@ -68,4 +68,4 @@ class S3Connection(AWSAuthConnection): def lookup(self, bucket_name, validate: bool = ..., headers: Optional[Dict[Text, Text]] = ...): ... def create_bucket(self, bucket_name, headers: Optional[Dict[Text, Text]] = ..., location: Any = ..., policy: Optional[Any] = ...): ... def delete_bucket(self, bucket, headers: Optional[Dict[Text, Text]] = ...): ... - def make_request(self, method, bucket: str = ..., key: str = ..., headers: Optional[Any] = ..., data: str = ..., query_args: Optional[Any] = ..., sender: Optional[Any] = ..., override_num_retries: Optional[Any] = ..., retry_handler: Optional[Any] = ..., *args, **kwargs): ... + def make_request(self, method, bucket: str = ..., key: str = ..., headers: Optional[Any] = ..., data: str = ..., query_args: Optional[Any] = ..., sender: Optional[Any] = ..., override_num_retries: Optional[Any] = ..., retry_handler: Optional[Any] = ..., *args, **kwargs): ... # FIXME: signature incompatible with base class