@@ -558,18 +558,18 @@ def test_static_route_path_existence_check() -> None:
558558 web .StaticResource ("/" , nodirectory )
559559
560560
561- async def test_static_file_huge (aiohttp_client , tmpdir ) -> None :
561+ async def test_static_file_huge (aiohttp_client , tmp_path ) -> None :
562562 filename = "huge_data.unknown_mime_type"
563563
564564 # fill 20MB file
565- with tmpdir . join ( filename ).open ("wb" ) as f :
565+ with ( tmp_path / filename ).open ("wb" ) as f :
566566 for i in range (1024 * 20 ):
567567 f .write ((chr (i % 64 + 0x20 ) * 1024 ).encode ())
568568
569- file_st = os .stat (str (tmpdir . join ( filename )))
569+ file_st = os .stat (str (( tmp_path / filename )))
570570
571571 app = web .Application ()
572- app .router .add_static ("/static" , str (tmpdir ))
572+ app .router .add_static ("/static" , str (tmp_path ))
573573 client = await aiohttp_client (app )
574574
575575 resp = await client .get ("/static/" + filename )
@@ -579,7 +579,7 @@ async def test_static_file_huge(aiohttp_client, tmpdir) -> None:
579579 assert resp .headers .get ("CONTENT-ENCODING" ) is None
580580 assert int (resp .headers .get ("CONTENT-LENGTH" )) == file_st .st_size
581581
582- f = tmpdir . join ( filename ).open ("rb" )
582+ f = ( tmp_path / filename ).open ("rb" )
583583 off = 0
584584 cnt = 0
585585 while off < file_st .st_size :
@@ -988,11 +988,11 @@ async def handler(request):
988988 await client .close ()
989989
990990
991- async def test_static_file_huge_cancel (aiohttp_client , tmpdir ) -> None :
991+ async def test_static_file_huge_cancel (aiohttp_client , tmp_path ) -> None :
992992 filename = "huge_data.unknown_mime_type"
993993
994994 # fill 100MB file
995- with tmpdir . join ( filename ).open ("wb " ) as f :
995+ with ( tmp_path / filename ).open ("w " ) as f :
996996 for i in range (1024 * 20 ):
997997 f .write ((chr (i % 64 + 0x20 ) * 1024 ).encode ())
998998
@@ -1005,7 +1005,7 @@ async def handler(request):
10051005 tr = request .transport
10061006 sock = tr .get_extra_info ("socket" )
10071007 sock .setsockopt (socket .SOL_SOCKET , socket .SO_SNDBUF , 1024 )
1008- ret = web .FileResponse (pathlib .Path (str (tmpdir . join ( filename ))))
1008+ ret = web .FileResponse (pathlib .Path (str (( tmp_path / filename ))))
10091009 return ret
10101010
10111011 app = web .Application ()
@@ -1029,11 +1029,11 @@ async def handler(request):
10291029 await client .close ()
10301030
10311031
1032- async def test_static_file_huge_error (aiohttp_client , tmpdir ) -> None :
1032+ async def test_static_file_huge_error (aiohttp_client , tmp_path ) -> None :
10331033 filename = "huge_data.unknown_mime_type"
10341034
10351035 # fill 20MB file
1036- with tmpdir . join ( filename ).open ("wb" ) as f :
1036+ with ( tmp_path / filename ).open ("wb" ) as f :
10371037 f .seek (20 * 1024 * 1024 )
10381038 f .write (b"1" )
10391039
@@ -1042,7 +1042,7 @@ async def handler(request):
10421042 tr = request .transport
10431043 sock = tr .get_extra_info ("socket" )
10441044 sock .setsockopt (socket .SOL_SOCKET , socket .SO_SNDBUF , 1024 )
1045- ret = web .FileResponse (pathlib .Path (str (tmpdir . join ( filename ))))
1045+ ret = web .FileResponse (pathlib .Path (str (( tmp_path / filename ))))
10461046 return ret
10471047
10481048 app = web .Application ()
0 commit comments