Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade libraries #215

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ jobs:
run: pytest --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
with:
token: b1c643cb-040e-4c87-9f7d-5129d97daac0
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
Expand Down
4 changes: 2 additions & 2 deletions examples/resources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ def health_auth_check() -> Dict:
return dict(greeting="I'm authenticated and healthy !!!")


@app.get('/raise_cuenca_errors')
@app.get('/raise_cuenca_errors', response_model=None)
def raise_cuenca_errors() -> NoReturn:
raise WrongCredsError('you are not lucky enough!')


@app.get('/raise_fast_agave_errors')
@app.get('/raise_fast_agave_errors', response_model=None)
def raise_fast_agave_errors() -> NoReturn:
raise UnauthorizedError('nice try!')

Expand Down
3 changes: 2 additions & 1 deletion examples/resources/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async def update(
user: UserModel, request: UserUpdateRequest, api_request: Request
) -> Response:
user.name = request.name
user.ip = api_request.client.host
if api_request.client is not None:
user.ip = api_request.client.host
await user.async_save()
return Response(content=user.to_dict(), status_code=200)
2 changes: 1 addition & 1 deletion fast_agave/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.14.1'
__version__ = '0.15.0.dev1'
6 changes: 3 additions & 3 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ flake8==4.0.*
isort==5.10.*
mock==4.0.3
mongomock==4.1.*
moto[server]==2.2.*
moto[server,sqs]==5.0.9
mypy==1.0.1
pytest==7.4.*
pytest-cov==4.1.*
pytest-vcr==1.0.*
pytest-asyncio==0.15.*
requests==2.28.*
boto3==1.20.24
botocore==1.23.24
boto3==1.34.106
botocore==1.34.106
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
aiobotocore==2.1.0
cuenca-validations==0.11.19
fastapi==0.68.2
mongoengine-plus==0.0.3
python-multipart==0.0.5
aiobotocore==2.13.0
cuenca-validations==0.11.29
fastapi==0.111.0
mongoengine-plus==0.2.2
python-multipart==0.0.9
starlette-context==0.3.3
types-aiobotocore-sqs==2.1.0.post1
14 changes: 12 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,13 @@ def aws_credentials() -> None:
def aws_endpoint_urls(
aws_credentials,
) -> Generator[Dict[str, str], None, None]:
sqs = subprocess.Popen(['moto_server', 'sqs', '-p', '4000'])
sqs = subprocess.Popen(
[
'moto_server',
'-p',
'4000',
]
)

endpoints = dict(
sqs='http://127.0.0.1:4000/',
Expand Down Expand Up @@ -222,7 +228,11 @@ async def sqs_client():
session = aiobotocore.session.get_session()
async with session.create_client('sqs', 'us-east-1') as sqs:
await sqs.create_queue(
QueueName='core.fifo', Attributes={'FifoQueue': 'true'}
QueueName='core.fifo',
Attributes={
'FifoQueue': 'true',
'ContentBasedDeduplication': 'true',
},
)
resp = await sqs.get_queue_url(QueueName='core.fifo')
sqs.send_message = partial(sqs.send_message, QueueUrl=resp['QueueUrl'])
Expand Down
8 changes: 4 additions & 4 deletions tests/tasks/test_sqs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ async def my_task(data: Dict) -> None:
max_retries=3,
)(my_task)()

expected_calls = [call(test_message)] * 4
expected_calls = [call(test_message)] * 3
async_mock_function.assert_has_calls(expected_calls)
assert async_mock_function.call_count == len(expected_calls)

Expand Down Expand Up @@ -380,9 +380,9 @@ async def countdown_tester(data: Dict):
async def test_concurrency_controller(
sqs_client,
) -> None:
message_id = str(uuid.uuid4())
test_message = dict(id=message_id, name='fast-agave')
for i in range(5):
message_id = str(uuid.uuid4())
test_message = dict(id=message_id, name='fast-agave')
await sqs_client.send_message(
MessageBody=json.dumps(test_message),
MessageGroupId=message_id,
Expand All @@ -405,4 +405,4 @@ async def task_counter(data: Dict) -> None:
)(task_counter)()

running_tasks = [call[0] for call, _ in async_mock_function.call_args_list]
assert max(running_tasks) == 2
assert max(running_tasks) == 3
Loading