1919 UploadedPart ,
2020)
2121from moto .server import ThreadedMotoServer
22- from pydantic import AnyUrl , ByteSize , TypeAdapter , parse_obj_as
22+ from pydantic import AnyUrl , ByteSize , TypeAdapter
2323from pytest_mock import MockerFixture
2424from servicelib .aiohttp import status
2525from servicelib .progress_bar import ProgressBarData
@@ -212,8 +212,7 @@ async def _creator(num_upload_links: int, chunk_size: ByteSize) -> FileUploadSch
212212 assert "UploadId" in response
213213 upload_id = response ["UploadId" ]
214214
215- upload_links = parse_obj_as (
216- list [AnyUrl ],
215+ upload_links = TypeAdapter (list [AnyUrl ]).validate_python (
217216 await asyncio .gather (
218217 * [
219218 aiobotocore_s3_client .generate_presigned_url (
@@ -258,6 +257,7 @@ async def test_upload_file_to_presigned_links(
258257 create_file_of_size : Callable [[ByteSize ], Path ],
259258 file_size : ByteSize ,
260259 used_chunk_size : ByteSize ,
260+ faker : Faker ,
261261):
262262 """This test is here to reproduce the issue https://github.com/ITISFoundation/osparc-simcore/issues/3531
263263 One theory is that something might be wrong in how the chunking is done and that AWS times out
@@ -272,11 +272,11 @@ async def test_upload_file_to_presigned_links(
272272 """
273273 local_file = create_file_of_size (file_size )
274274 num_links = 2080
275- effective_chunk_size = parse_obj_as (ByteSize , local_file .stat ().st_size / num_links )
275+ effective_chunk_size = TypeAdapter (ByteSize ). validate_python ( local_file .stat ().st_size / num_links )
276276 assert effective_chunk_size <= used_chunk_size
277277 upload_links = await create_upload_links (num_links , used_chunk_size )
278278 assert len (upload_links .urls ) == num_links
279- async with ProgressBarData (num_steps = 1 ) as progress_bar :
279+ async with ProgressBarData (num_steps = 1 , description = faker . pystr () ) as progress_bar :
280280 uploaded_parts : list [UploadedPart ] = await upload_file_to_presigned_links (
281281 session = client_session ,
282282 file_upload_links = upload_links ,
0 commit comments