Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: Make test_movie_writer_invalid_path locale-agnostic #27377

Merged
merged 1 commit into from Nov 28, 2023

Conversation

StefRe
Copy link
Contributor

@StefRe StefRe commented Nov 27, 2023

PR summary

Filtering on the error message failed on locales different from English (just matching the error in brackets would also do).
No big deal, though, but a bit annoying on Windows were you can't so easily change the locale for a single command to run.

PR checklist

Filtering on the error message failed on locales different from
English (just matching the error in brackets would also do).
@story645 story645 merged commit adb9fd4 into matplotlib:main Nov 28, 2023
43 of 44 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Nov 28, 2023
Comment on lines -548 to -550
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know a merged this so too late 😓 but could these be combined in an or string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could these be combined in an or string?

The two match strings could be combined into one string like this:

def test_movie_writer_invalid_path(anim):
    with pytest.raises(
        FileNotFoundError,
        match=r"\[(?:WinError 3|Errno 2)] .*'(?:\\\\foo\\\\bar\\\\aardvark|/foo)'",
    ):
        anim.save("/foo/bar/aardvark/thiscannotreallyexist.mp4",
                  writer=animation.FFMpegFileWriter())

but I think the explicit condition for win32 or else is easier to read and comprehend.

QuLogic added a commit that referenced this pull request Nov 28, 2023
…377-on-v3.8.x

Backport PR #27377 on branch v3.8.x (TST: Make test_movie_writer_invalid_path locale-agnostic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants