This repository was archived by the owner on Nov 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ dynamic = [ "version" ]
2626[project .optional-dependencies ]
2727test = [
2828 " pytest" ,
29- " pytest-dynamodb @ git+https://github.com/lpsinger/pytest-dynamodb@aioboto3" ,
29+ " pytest-asyncio" ,
30+ " pytest-dynamodb" ,
3031]
3132
3233[project .urls ]
Original file line number Diff line number Diff line change 22# Administrator of the National Aeronautics and Space Administration.
33# All Rights Reserved.
44
5- from botocore .exceptions import ClientError
65import asyncio
6+
7+ import aioboto3
78import pytest
9+ from botocore .exceptions import ClientError
10+ from pytest import FixtureRequest
811from pytest_asyncio import fixture as asyncio_fixture
12+ from pytest_dynamodb .factories import get_config
913
1014from dynamodb_autoincrement import DynamoDBAutoIncrement , DynamoDBHistoryAutoIncrement
1115
12-
1316N = 20
1417
1518
19+ @asyncio_fixture
20+ async def asyncio_dynamodb (request : FixtureRequest , dynamodb ):
21+ proc_fixture = request .getfixturevalue ("dynamodb_proc" )
22+ config = get_config (request )
23+
24+ session = aioboto3 .Session (
25+ aws_access_key_id = config ["aws_access_key" ],
26+ aws_secret_access_key = config ["aws_secret_key" ],
27+ region_name = config ["aws_region" ],
28+ )
29+
30+ async with session .resource (
31+ "dynamodb" , endpoint_url = f"http://{ proc_fixture .host } :{ proc_fixture .port } "
32+ ) as dynamo_db :
33+ yield dynamo_db
34+
35+
1636@asyncio_fixture
1737async def create_tables (asyncio_dynamodb ):
1838 await asyncio .gather (
You can’t perform that action at this time.
0 commit comments