@@ -128,7 +128,8 @@ def test_config_build_from():
128128 ],
129129)
130130def test_get_media_info (media_format , media , expected , test_files ):
131- with tempfile .TemporaryDirectory () as t , pathlib .Path (t ).joinpath (media ) as src :
131+ with tempfile .TemporaryDirectory () as t :
132+ src = pathlib .Path (t ).joinpath (media )
132133 shutil .copy2 (test_files [media_format ], src )
133134 assert get_media_info (src ) == expected
134135
@@ -342,7 +343,8 @@ def test_preset_voice_mp3_low():
342343 ],
343344)
344345def test_reencode_media (src , dest , ffmpeg_args , expected , test_files ):
345- with tempfile .TemporaryDirectory () as t , pathlib .Path (t ) as temp_dir :
346+ with tempfile .TemporaryDirectory () as t :
347+ temp_dir = pathlib .Path (t )
346348 copy_media_and_reencode (temp_dir , src , dest , ffmpeg_args , test_files )
347349 converted_details = get_media_info (temp_dir .joinpath (dest ))
348350 assert expected ["duration" ] == converted_details ["duration" ]
@@ -368,9 +370,10 @@ def test_reencode_media(src, dest, ffmpeg_args, expected, test_files):
368370 ],
369371)
370372def test_reencode_delete_src (src , dest , ffmpeg_args , delete_src , test_files ):
371- with tempfile .TemporaryDirectory () as t , pathlib .Path (
372- t
373- ) as temp_dir , temp_dir .joinpath (src ) as src_path :
373+ with tempfile .TemporaryDirectory () as t :
374+ temp_dir = pathlib .Path (t )
375+ src_path = temp_dir .joinpath (src )
376+
374377 copy_media_and_reencode (
375378 temp_dir , src , dest , ffmpeg_args , test_files , delete_src = delete_src
376379 )
@@ -401,7 +404,8 @@ def test_reencode_delete_src(src, dest, ffmpeg_args, delete_src, test_files):
401404def test_reencode_return_ffmpeg_output (
402405 src , dest , ffmpeg_args , return_output , test_files
403406):
404- with tempfile .TemporaryDirectory () as t , pathlib .Path (t ) as temp_dir :
407+ with tempfile .TemporaryDirectory () as t :
408+ temp_dir = pathlib .Path (t )
405409 ret = copy_media_and_reencode (
406410 temp_dir ,
407411 src ,
@@ -437,7 +441,8 @@ def test_reencode_return_ffmpeg_output(
437441 ],
438442)
439443def test_reencode_failsafe (src , dest , ffmpeg_args , failsafe , test_files ):
440- with tempfile .TemporaryDirectory () as t , pathlib .Path (t ) as temp_dir :
444+ with tempfile .TemporaryDirectory () as t :
445+ temp_dir = pathlib .Path (t )
441446 if not failsafe :
442447 with pytest .raises (subprocess .CalledProcessError ) as exc_info :
443448 copy_media_and_reencode (
0 commit comments