def test_write_videofiles_audio_codec_error(util, video):
    """Checks error cases return helpful messages."""
    clip = video()
    location = os.path.join(util.TMP_DIR, "unlogged-write.mp4")
    with pytest.raises(IOError) as e:
        clip.write_videofile(
            location, audio="media/crunching.mp3", audio_codec="nonexistent-codec"
        )
    assert (
        "The video export failed because FFMPEG didn't find the specified"
        " codec for video or audio" in str(e.value)
    ), e.value

    autogenerated_location = "unlogged-writeTEMP_MPY_wvf_snd.mp3"
    if os.path.exists(autogenerated_location):
        os.remove(autogenerated_location)
Checks error cases return helpful messages.
tests/test_VideoClip.py