Skip to content

Commit

Permalink
Merge pull request #39 from nrccua/DS-78-remove-logging-in-aws-utils-py
Browse files Browse the repository at this point in the history
Ds 78 remove logging in aws utils py
  • Loading branch information
nrccua-timr authored Jun 9, 2021
2 parents 7e785b2 + d8d54e3 commit dac097b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 26 deletions.
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ History
=======


v0.13.12 (2021-06-09)

* Remove logging in aioradio/aws/utils.py.
* Skip all tests interacting with FTP.


v0.13.11 (2021-06-03)

* Add SQL Server 2017 driver path for Debian operating systems.
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ pre-commit:

twine:
. env/bin/activate; \
python setup.py sdist bdist_wheel
twine upload dist/*
python setup.py sdist bdist_wheel; \
twine upload dist/*; \
make setup

all: install pre-commit lint test setup clean
10 changes: 1 addition & 9 deletions aioradio/aws/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# pylint: disable=protected-access

import asyncio
import logging
from asyncio import sleep
from copy import deepcopy
from dataclasses import dataclass, field
Expand All @@ -18,8 +17,6 @@
import aiobotocore
import aiojobs

LOG = logging.getLogger(__name__)


@dataclass
class AwsServiceManager:
Expand Down Expand Up @@ -134,13 +131,9 @@ async def establish_client_resource(self, service_dict: Dict[str, Any], item: st
"""

kwargs = {'service_name': self.service, 'verify': False}
if region == '':
phrase = f're-establish {self.service}' if reestablish else f'establish {self.service}'
else:
if region:
kwargs['region_name'] = region
phrase = f're-establish {self.service} {region}' if reestablish else f'establish {self.service} {region}'

LOG.info(f'Atempting to {phrase} service object...')
if reestablish:
service_dict['busy'] = True
await service_dict['obj'].__aexit__(None, None, None)
Expand All @@ -153,7 +146,6 @@ async def establish_client_resource(self, service_dict: Dict[str, Any], item: st
service_dict['obj'] = await func(**kwargs).__aenter__()

service_dict['busy'] = False
LOG.info(f'Successfully {phrase} service object!')

def get_region(self, args: List[Any], kwargs: Dict[str, Any]) -> str:
"""Attempt to detect the region from the kwargs or args.
Expand Down
2 changes: 1 addition & 1 deletion aioradio/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ aioboto3==8.3.0
aiobotocore==1.3.0
aiojobs==0.3.0
ddtrace==0.49.2
fakeredis==1.5.1
fakeredis==1.5.2
flask==2.0.1
httpx==0.18.1
mandrill==1.0.60
Expand Down
20 changes: 8 additions & 12 deletions aioradio/tests/file_ingestion_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ async def test_send_emails_via_mandrill():
assert result[0]['status'] in ['sent', 'queued']


async def test_write_file_to_ftp(github_action, request):
async def test_write_file_to_ftp(request):
"""Test write_file_to_ftp."""

if github_action:
pytest.skip('Skip test_write_file_to_ftp when running via Github Action')
pytest.skip('Skip test_write_file_to_ftp')

filepath = os.path.join(request.fspath.dirname, 'test_data', 'test_file_ingestion.zip')

Expand All @@ -118,11 +117,10 @@ async def test_write_file_to_ftp(github_action, request):
assert now > last_write_time and now - last_write_time < 10


async def test_list_ftp_objects(github_action):
async def test_list_ftp_objects():
"""Test test_list_ftp_objects."""

if github_action:
pytest.skip('Skip test_list_ftp_objects when running via Github Action')
pytest.skip('Skip test_list_ftp_objects')

conn = await establish_ftp_connection(
user=CREDS['ftp_user'],
Expand All @@ -141,11 +139,10 @@ async def test_list_ftp_objects(github_action):
assert results[0].filename == 'test_file_ingestion.zip'


async def test_list_ftp_objects_with_regex(github_action):
async def test_list_ftp_objects_with_regex():
"""Test test_list_ftp_objects with regex."""

if github_action:
pytest.skip('Skip test_list_ftp_objects_with_regex when running via Github Action')
pytest.skip('Skip test_list_ftp_objects_with_regex')

conn = await establish_ftp_connection(
user=CREDS['ftp_user'],
Expand All @@ -166,11 +163,10 @@ async def test_list_ftp_objects_with_regex(github_action):
assert results[0].filename == 'test_file_ingestion.zip'


async def test_delete_ftp_file(github_action):
async def test_delete_ftp_file():
"""Test delete_ftp_file."""

if github_action:
pytest.skip('Skip test_list_ftp_objects_with_regex when running via Github Action')
pytest.skip('Skip test_list_ftp_objects_with_regex')

conn = await establish_ftp_connection(
user=CREDS['ftp_user'],
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
long_description = fileobj.read()

setup(name='aioradio',
version='0.13.11',
version='0.13.12',
description='Generic asynchronous i/o python utilities for AWS services (SQS, S3, DynamoDB, Secrets Manager), Redis, MSSQL (pyodbc), JIRA and more',
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -19,8 +19,8 @@
'aioradio/aws',
],
install_requires=[
'aiobotocore',
'aioboto3',
'aiobotocore',
'aiojobs',
'boto3',
'ddtrace',
Expand Down

0 comments on commit dac097b

Please sign in to comment.