diff --git a/flamenco_worker/commands.py b/flamenco_worker/commands.py index 2827c511bc711102a8c8c23ecfa8d3a379f80cb7..a26f5f8c0c344a0a61c1912533de9cc35570c91a 100644 --- a/flamenco_worker/commands.py +++ b/flamenco_worker/commands.py @@ -1171,10 +1171,10 @@ class ConcatenateVideosCommand(AbstractFFmpegCommand): args = [ '-f', 'concat', - '-i', str(self.index_file), + '-i', self.index_file.as_posix(), '-c', 'copy', '-y', - str(output_file), + output_file.as_posix(), ] return args diff --git a/tests/test_commands_blender_render.py b/tests/test_commands_blender_render.py index 09413194621ad441d20ed91c3772b4e2753d1bc0..0dc89dfe2d6809371330128b5dd327b45b408844 100644 --- a/tests/test_commands_blender_render.py +++ b/tests/test_commands_blender_render.py @@ -88,7 +88,7 @@ class BlenderRenderTest(AbstractCommandTest): """Test that CLI arguments in the blender_cmd setting are handled properly.""" from tests.mock_responses import CoroMock - filepath = str(Path(__file__).parent) + filepath = Path(__file__).parent.as_posix() settings = { # Point blender_cmd to this file so that we're sure it exists. 'blender_cmd': f'{self.thisfile!r} --with --cli="args for CLI"', @@ -122,7 +122,7 @@ class BlenderRenderTest(AbstractCommandTest): def test_python_expr(self): from tests.mock_responses import CoroMock - filepath = str(Path(__file__).parent) + filepath = Path(__file__).parent.as_posix() settings = { # Point blender_cmd to this file so that we're sure it exists. 'blender_cmd': f'{self.thisfile!r} --with --cli="args for CLI"', @@ -140,7 +140,7 @@ class BlenderRenderTest(AbstractCommandTest): self.loop.run_until_complete(self.cmd.run(settings)) mock_cse.assert_called_once_with( - __file__, + self.thisfile, '--with', '--cli=args for CLI', '--enable-autoexec', diff --git a/tests/test_commands_blender_render_audio.py b/tests/test_commands_blender_render_audio.py index dfa3fe27a3285581810492cde6aeb76eca7afb25..9172efe2a8fca03df4e9fbbe9314692fd4660292 100644 --- a/tests/test_commands_blender_render_audio.py +++ b/tests/test_commands_blender_render_audio.py @@ -16,6 +16,8 @@ bpy.ops.wm.quit_blender() class RenderAudioTest(AbstractCommandTest): + thisfile = Path(__file__).as_posix() + def setUp(self): super().setUp() @@ -30,13 +32,12 @@ class RenderAudioTest(AbstractCommandTest): def test_cli_args(self): from tests.mock_responses import CoroMock - filepath = Path(__file__) settings = { # Point blender_cmd to this file so that we're sure it exists. - 'blender_cmd': '%s --with --cli="args for CLI"' % __file__, + 'blender_cmd': f'{self.thisfile!r} --with --cli="args for CLI"', 'frame_start': 1, 'frame_end': 47, - 'filepath': str(filepath), + 'filepath': self.thisfile, 'render_output': '/tmp/output.flac', } @@ -47,13 +48,13 @@ class RenderAudioTest(AbstractCommandTest): self.loop.run_until_complete(self.cmd.run(settings)) mock_cse.assert_called_once_with( - __file__, + self.thisfile, '--with', '--cli=args for CLI', '--enable-autoexec', '-noaudio', '--background', - str(filepath), + self.thisfile, '--python-exit-code', '47', '--python-expr', expected_script, stdin=subprocess.DEVNULL, diff --git a/tests/test_commands_concat_videos.py b/tests/test_commands_concat_videos.py index 52383c92c6777739dd4628eae4e7d6e659586d3c..a6dcb4bcfa28ecd6286bee83a3ae2b39ffe67314 100644 --- a/tests/test_commands_concat_videos.py +++ b/tests/test_commands_concat_videos.py @@ -15,7 +15,7 @@ frame_dir = Path(__file__).with_name('test_frames') class ConcatVideosTest(AbstractCommandTest): settings: typing.Dict[str, typing.Any] = { - 'ffmpeg_cmd': f'"{sys.executable}" -hide_banner', + 'ffmpeg_cmd': f'{Path(sys.executable).absolute().as_posix()!r} -hide_banner', 'input_files': str(frame_dir / 'chunk-*.mkv'), 'output_file': '/tmp/merged.mkv', } @@ -37,9 +37,9 @@ class ConcatVideosTest(AbstractCommandTest): cliargs = self.cmd._build_ffmpeg_command(self.settings) self.assertEqual([ - sys.executable, '-hide_banner', + Path(sys.executable).as_posix(), '-hide_banner', '-f', 'concat', - '-i', str(frame_dir / 'ffmpeg-input.txt'), + '-i', (frame_dir / 'ffmpeg-input.txt').as_posix(), '-c', 'copy', '-y', '/tmp/merged.mkv', @@ -51,7 +51,7 @@ class ConcatVideosTest(AbstractCommandTest): settings: typing.Dict[str, typing.Any] = { **self.settings, 'ffmpeg_cmd': 'ffmpeg', # use the real FFmpeg for this test. - 'output_file': str(outfile), + 'output_file': outfile.as_posix(), } self.loop.run_until_complete(self.cmd.run(settings)) @@ -60,7 +60,7 @@ class ConcatVideosTest(AbstractCommandTest): ffprobe_cmd = [shutil.which('ffprobe'), '-v', 'error', '-show_entries', 'format=duration', '-of', 'default=noprint_wrappers=1:nokey=1', - str(outfile)] + outfile.as_posix()] log.debug('Running %s', ' '.join(shlex.quote(arg) for arg in ffprobe_cmd)) probe_out = subprocess.check_output(ffprobe_cmd) probed_duration = float(probe_out) diff --git a/tests/test_commands_create_video.py b/tests/test_commands_create_video.py index 4128705e5569dec9e6a4b59acd04a57fb86a9bff..99efb1f43538bc93bbf385071a03688a6822a52f 100644 --- a/tests/test_commands_create_video.py +++ b/tests/test_commands_create_video.py @@ -14,7 +14,7 @@ log = logging.getLogger(__name__) class CreateVideoTest(AbstractCommandTest): settings: typing.Dict[str, typing.Any] = { - 'ffmpeg_cmd': f'"{sys.executable}" -hide_banner', + 'ffmpeg_cmd': f'{Path(sys.executable).absolute().as_posix()!r} -hide_banner', 'input_files': '/tmp/*.png', 'output_file': '/tmp/merged.mkv', 'fps': 24, @@ -49,7 +49,7 @@ class CreateVideoTest(AbstractCommandTest): cliargs = self.cmd._build_ffmpeg_command(self.settings) self.assertEqual([ - sys.executable, '-hide_banner', + Path(sys.executable).absolute().as_posix(), '-hide_banner', '-pattern_type', 'glob', '-r', '24', '-i', '/tmp/*.png', @@ -68,8 +68,8 @@ class CreateVideoTest(AbstractCommandTest): settings: typing.Dict[str, typing.Any] = { **self.settings, 'ffmpeg_cmd': 'ffmpeg', # use the real FFmpeg for this test. - 'input_files': f'{frame_dir}/*.png', - 'output_file': str(outfile), + 'input_files': f'{frame_dir.as_posix()}/*.png', + 'output_file': outfile.as_posix(), } self.loop.run_until_complete(self.cmd.run(settings)) @@ -78,7 +78,7 @@ class CreateVideoTest(AbstractCommandTest): ffprobe_cmd = [shutil.which('ffprobe'), '-v', 'error', '-show_entries', 'format=duration', '-of', 'default=noprint_wrappers=1:nokey=1', - str(outfile)] + outfile.as_posix()] log.debug('Running %s', ' '.join(shlex.quote(arg) for arg in ffprobe_cmd)) probe_out = subprocess.check_output(ffprobe_cmd) probed_duration = float(probe_out)