Test that we correctly raise a CalledProcessError when ffmpeg fails. To do so, mock ffmpeg using a simple executable shell script that succeeds when called with no arguments (so that it gets registered by `isAvailable`), but fails otherwise, and add it to the $PATH.
(tmp_path, monkeypatch, anim)
| 312 | reason='emscripten does not support subprocesses') |
| 313 | @pytest.mark.skipif(shutil.which("/bin/sh") is None, reason="requires a POSIX OS") |
| 314 | def test_failing_ffmpeg(tmp_path, monkeypatch, anim): |
| 315 | """ |
| 316 | Test that we correctly raise a CalledProcessError when ffmpeg fails. |
| 317 | |
| 318 | To do so, mock ffmpeg using a simple executable shell script that |
| 319 | succeeds when called with no arguments (so that it gets registered by |
| 320 | `isAvailable`), but fails otherwise, and add it to the $PATH. |
| 321 | """ |
| 322 | monkeypatch.setenv("PATH", str(tmp_path), prepend=":") |
| 323 | exe_path = tmp_path / "ffmpeg" |
| 324 | exe_path.write_bytes(b"#!/bin/sh\n[[ $@ -eq 0 ]]\n") |
| 325 | os.chmod(exe_path, 0o755) |
| 326 | with pytest.raises(subprocess.CalledProcessError): |
| 327 | anim.save("test.mpeg") |
| 328 | |
| 329 | |
| 330 | @pytest.mark.parametrize("cache_frame_data", [False, True]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…