Fix style issues

This commit is contained in:
Adrián Chaves 2020-09-21 23:28:16 +02:00
parent c3b740f078
commit 8f46e84519
3 changed files with 1 additions and 15 deletions

View File

@ -23,18 +23,6 @@ def skip_if_no_boto():
raise SkipTest('missing botocore library')
def get_s3_content_and_delete(bucket, path, with_key=False):
""" Get content from s3 key, and delete key afterwards.
"""
import botocore.session
session = botocore.session.get_session()
client = session.create_client('s3')
key = client.get_object(Bucket=bucket, Key=path)
content = key['Body'].read()
client.delete_object(Bucket=bucket, Key=path)
return (content, key) if with_key else content
def get_gcs_content_and_delete(bucket, path):
from google.cloud import storage
client = storage.Client(project=os.environ.get('GCS_PROJECT_ID'))

View File

@ -41,7 +41,6 @@ from scrapy.extensions.feedexport import (
from scrapy.settings import Settings
from scrapy.utils.python import to_unicode
from scrapy.utils.test import (
get_s3_content_and_delete,
get_crawler,
mock_google_cloud_storage,
skip_if_no_boto,
@ -1577,7 +1576,7 @@ class BatchDeliveriesTest(FeedExportTestBase):
TestSpider.start_urls = [server.url('/')]
yield runner.crawl(TestSpider)
self.assertEqual(len(CustomS3FeedStorage.stubs), len(items)+1)
self.assertEqual(len(CustomS3FeedStorage.stubs), len(items) + 1)
for stub in CustomS3FeedStorage.stubs[:-1]:
stub.assert_no_pending_responses()

View File

@ -27,7 +27,6 @@ from scrapy.utils.test import (
assert_gcs_environ,
get_ftp_content_and_delete,
get_gcs_content_and_delete,
get_s3_content_and_delete,
skip_if_no_boto,
)