diff --git a/docs/contributing.rst b/docs/contributing.rst index 288dcf0..f8e36d4 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -103,10 +103,10 @@ This will run only tests that look like ``test_status_code`` or ``test_gzip`` in the test suite, and only in the python 3.8 environment that has ``requests`` installed. -Also, in order for the boto tests to run, you will need an AWS key. -Refer to the `boto -documentation `__ -for how to set this up. I have marked the boto tests as optional in +Also, in order for the boto3 tests to run, you will need an AWS key. +Refer to the `boto3 +documentation `__ +for how to set this up. I have marked the boto3 tests as optional in Travis so you don't have to worry about them failing if you submit a pull request. diff --git a/docs/installation.rst b/docs/installation.rst index f63e02c..21def63 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -14,7 +14,6 @@ VCR.py supports Python 3.8+, and `pypy `__. The following HTTP libraries are supported: - ``aiohttp`` -- ``boto`` - ``boto3`` - ``http.client`` - ``httplib2`` diff --git a/tests/integration/test_boto.py b/tests/integration/test_boto.py deleted file mode 100644 index fcf5a44..0000000 --- a/tests/integration/test_boto.py +++ /dev/null @@ -1,82 +0,0 @@ -from configparser import DuplicateSectionError - -import pytest - -import vcr - -boto = pytest.importorskip("boto") - -import boto # noqa -import boto.iam # noqa -from boto.s3.connection import S3Connection # noqa -from boto.s3.key import Key # noqa - - -def test_boto_stubs(tmpdir): - with vcr.use_cassette(str(tmpdir.join("boto-stubs.yml"))): - # Perform the imports within the patched context so that - # CertValidatingHTTPSConnection refers to the patched version. - from boto.https_connection import CertValidatingHTTPSConnection - - from vcr.stubs.boto_stubs import VCRCertValidatingHTTPSConnection - - # Prove that the class was patched by the stub and that we can instantiate it. - assert issubclass(CertValidatingHTTPSConnection, VCRCertValidatingHTTPSConnection) - CertValidatingHTTPSConnection("hostname.does.not.matter") - - -def test_boto_without_vcr(): - s3_conn = S3Connection() - s3_bucket = s3_conn.get_bucket("boto-demo-1394171994") # a bucket you can access - k = Key(s3_bucket) - k.key = "test.txt" - k.set_contents_from_string("hello world i am a string") - - -def test_boto_medium_difficulty(tmpdir): - s3_conn = S3Connection() - s3_bucket = s3_conn.get_bucket("boto-demo-1394171994") # a bucket you can access - with vcr.use_cassette(str(tmpdir.join("boto-medium.yml"))): - k = Key(s3_bucket) - k.key = "test.txt" - k.set_contents_from_string("hello world i am a string") - - with vcr.use_cassette(str(tmpdir.join("boto-medium.yml"))): - k = Key(s3_bucket) - k.key = "test.txt" - k.set_contents_from_string("hello world i am a string") - - -def test_boto_hardcore_mode(tmpdir): - with vcr.use_cassette(str(tmpdir.join("boto-hardcore.yml"))): - s3_conn = S3Connection() - s3_bucket = s3_conn.get_bucket("boto-demo-1394171994") # a bucket you can access - k = Key(s3_bucket) - k.key = "test.txt" - k.set_contents_from_string("hello world i am a string") - - with vcr.use_cassette(str(tmpdir.join("boto-hardcore.yml"))): - s3_conn = S3Connection() - s3_bucket = s3_conn.get_bucket("boto-demo-1394171994") # a bucket you can access - k = Key(s3_bucket) - k.key = "test.txt" - k.set_contents_from_string("hello world i am a string") - - -def test_boto_iam(tmpdir): - try: - boto.config.add_section("Boto") - except DuplicateSectionError: - pass - # Ensure that boto uses HTTPS - boto.config.set("Boto", "is_secure", "true") - # Ensure that boto uses CertValidatingHTTPSConnection - boto.config.set("Boto", "https_validate_certificates", "true") - - with vcr.use_cassette(str(tmpdir.join("boto-iam.yml"))): - iam_conn = boto.iam.connect_to_region("universal") - iam_conn.get_all_users() - - with vcr.use_cassette(str(tmpdir.join("boto-iam.yml"))): - iam_conn = boto.iam.connect_to_region("universal") - iam_conn.get_all_users() diff --git a/vcr/patch.py b/vcr/patch.py index abe089f..afcaab5 100644 --- a/vcr/patch.py +++ b/vcr/patch.py @@ -67,14 +67,6 @@ else: _HTTPSConnectionWithTimeout = httplib2.HTTPSConnectionWithTimeout _SCHEME_TO_CONNECTION = httplib2.SCHEME_TO_CONNECTION -# Try to save the original types for boto -try: - import boto.https_connection -except ImportError: # pragma: no cover - pass -else: - _CertValidatingHTTPSConnection = boto.https_connection.CertValidatingHTTPSConnection - # Try to save the original types for Tornado try: import tornado.simple_httpclient @@ -126,7 +118,6 @@ class CassettePatcherBuilder: self._boto3(), self._urllib3(), self._httplib2(), - self._boto(), self._tornado(), self._aiohttp(), self._httpx(), @@ -274,17 +265,6 @@ class CassettePatcherBuilder: "https": VCRHTTPSConnectionWithTimeout, } - @_build_patchers_from_mock_triples_decorator - def _boto(self): - try: - import boto.https_connection as cpool - except ImportError: # pragma: no cover - pass - else: - from .stubs.boto_stubs import VCRCertValidatingHTTPSConnection - - yield cpool, "CertValidatingHTTPSConnection", VCRCertValidatingHTTPSConnection - @_build_patchers_from_mock_triples_decorator def _tornado(self): try: @@ -447,13 +427,6 @@ def reset_patchers(): yield mock.patch.object(cpool, "HTTPSConnectionWithTimeout", _HTTPSConnectionWithTimeout) yield mock.patch.object(cpool, "SCHEME_TO_CONNECTION", _SCHEME_TO_CONNECTION) - try: - import boto.https_connection as cpool - except ImportError: # pragma: no cover - pass - else: - yield mock.patch.object(cpool, "CertValidatingHTTPSConnection", _CertValidatingHTTPSConnection) - try: import tornado.simple_httpclient as simple except ImportError: # pragma: no cover diff --git a/vcr/stubs/boto_stubs.py b/vcr/stubs/boto_stubs.py deleted file mode 100644 index fd33ade..0000000 --- a/vcr/stubs/boto_stubs.py +++ /dev/null @@ -1,9 +0,0 @@ -"""Stubs for boto""" - -from boto.https_connection import CertValidatingHTTPSConnection - -from ..stubs import VCRHTTPSConnection - - -class VCRCertValidatingHTTPSConnection(VCRHTTPSConnection): - _baseclass = CertValidatingHTTPSConnection