diff --git a/lib/matplotlib/tests/test_animation.py b/lib/matplotlib/tests/test_animation.py index a4de96d77b62..d026dae59533 100644 --- a/lib/matplotlib/tests/test_animation.py +++ b/lib/matplotlib/tests/test_animation.py @@ -545,9 +545,9 @@ def test_disable_cache_warning(anim): def test_movie_writer_invalid_path(anim): if sys.platform == "win32": - match_str = re.escape("[WinError 3] The system cannot find the path specified:") + match_str = r"\[WinError 3] .*'\\\\foo\\\\bar\\\\aardvark'" else: - match_str = re.escape("[Errno 2] No such file or directory: '/foo") + match_str = r"\[Errno 2] .*'/foo" with pytest.raises(FileNotFoundError, match=match_str): anim.save("/foo/bar/aardvark/thiscannotreallyexist.mp4", writer=animation.FFMpegFileWriter())