Skip to content

TST: Restore some tolerances for some arch/platform-specific failures#31343

Open
QuLogic wants to merge 2 commits intomatplotlib:text-overhaulfrom
QuLogic:test-tolerance
Open

TST: Restore some tolerances for some arch/platform-specific failures#31343
QuLogic wants to merge 2 commits intomatplotlib:text-overhaulfrom
QuLogic:test-tolerance

Conversation

@QuLogic
Copy link
Member

@QuLogic QuLogic commented Mar 20, 2026

PR summary

  • test_polar_box fails on Windows, ARM, and macOS.
  • test_axis_direction fails on ARM and macOS.

There are still a few more to fix, but just checking that these are fine.

AI Disclosure

None

PR checklist

@QuLogic QuLogic added this to the v3.11.0 milestone Mar 20, 2026
@github-project-automation github-project-automation bot moved this to Waiting for other PR in Font and text overhaul Mar 20, 2026
@QuLogic QuLogic moved this from Waiting for other PR to In Progress in Font and text overhaul Mar 20, 2026
The tolerance on these was increased in various PRs, with notes to
reduce/remove them, so they were removed in matplotlib#30184, but should have been
reverted to a smaller value.

- `test_floating_axes.py::test_curvelinear4[png]` fails on macOS
- `test_grid_helper_curvelinear.py::test_axis_direction[png]` fails on
  ARM and macOS
- `test_grid_helper_curvelinear.py::test_polar_box[png]` fails on
  Windows, ARM, and macOS

These fail on macOS; there's a tolerance on them already, they fail by
just a small amount, so increase it.

- `test_patheffects.py::test_collection[png]`
- `test_axes3d.py::test_scale3d_artists_log[png]`
Since Helvetica may or may not be installed, the line height measurement
may differ between systems, so multi-line text as in this test may
change.

This test doesn't care about line heights, but is about using PDF's
"standard" fonts, so we'll just manually place the lines.

Unfortunately, since text placement still depends on the exact split of
ascent/descent, we still need to add some increased tolerance here.

This will be fixed when all backends correctly apply font metrics for
line height, and PDF can arrange to use our bundled core 14 font
metrics for that.
@QuLogic QuLogic marked this pull request as ready for review March 24, 2026 17:46
@QuLogic
Copy link
Member Author

QuLogic commented Mar 24, 2026

OK, this is now passing.

The failure in test_use14corefonts does point out how backend-specific measurement is useful. PDF/PS support for using the core 14 fonts means it overrides get_text_width_height_descent and returns builtin metrics for those when the option is enabled. Since the line-height-from-font-metrics code doesn't use a backend-specific API for it, it doesn't see that override and is dependent on whether Helvetica is installed or not. So I regenerated it with Helvetica installed, but I've had to add a tolerance for other systems without it.

@QuLogic
Copy link
Member Author

QuLogic commented Mar 25, 2026

OK, it does require a bit of internal trickery, but instead of the last commit, we can instead do #31371.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant