Skip to content

Fix flaky labelcolor tests #28858

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

Merged
merged 1 commit into from
Sep 21, 2024
Merged

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Sep 21, 2024

PR summary

For labelcolor={linecolor,markeredgecolor,markerfacecolor}, text will match the specified attribute if consistent, but fall back to black if they differ within a single labeled artist.

These tests use 10 random colours out of the ['r', 'g', 'b'] set, so 3 (all red, all green, all blue) out of 3**10 will result in the text not being black. This is rare (0.0051%), but does happen once in a while (e.g., https://github.com/matplotlib/matplotlib/actions/runs/10967975776/job/30458622005).

Instead, just hard-code some different colours in the test.

PR checklist

For labelcolor={linecolor,markeredgecolor,markerfacecolor}, text will
match the specified attribute if consistent, but fall back to black if
they differ within a single labeled artist.

These tests use 10 random colours out of the ['r', 'g', 'b'] set, so 3
(all red, all green, all blue) out of 3**10 will result in the text
_not_ being black. This is rare (0.0051%), but does happen once in a
while.

Instead, just hard-code some different colours in the test.
@rcomer rcomer merged commit 5f962a3 into matplotlib:main Sep 21, 2024
44 of 47 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 21, 2024
@QuLogic QuLogic deleted the fix-test-labelcolor branch September 21, 2024 07:32
rcomer added a commit that referenced this pull request Sep 21, 2024
…858-on-v3.9.x

Backport PR #28858 on branch v3.9.x (Fix flaky labelcolor tests)
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.

3 participants