Skip to content

Refactor Tests#11

Merged
CSSFrancis merged 11 commits into
mainfrom
refactor_tests
May 11, 2026
Merged

Refactor Tests#11
CSSFrancis merged 11 commits into
mainfrom
refactor_tests

Conversation

@CSSFrancis
Copy link
Copy Markdown
Owner

Refactoring tests, renaming and organizing tests as well as merging tests into like files. Better handling for tests etc.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.61%. Comparing base (b1bc6d4) to head (a757c43).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #11   +/-   ##
=======================================
  Coverage   77.61%   77.61%           
=======================================
  Files          12       12           
  Lines        2319     2319           
=======================================
  Hits         1800     1800           
  Misses        519      519           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors and reorganizes the test suite by moving tests under anyplotlib/tests, consolidating coverage areas into more structured modules (layouts/interactive/documentation/benchmarks/plots), and adding/relocating baseline assets to support visual regression testing.

Changes:

  • Move/merge legacy tests/ modules into a package-scoped test tree (anyplotlib/tests/...) and update pytest discovery to match.
  • Add new structured test modules for Plot3D, markers, documentation bridge/scraper/push-hook, and pure-Python benchmarks.
  • Introduce/relocate PNG baseline assets and PNG encode/decode utilities for visual regression testing.

Reviewed changes

Copilot reviewed 26 out of 62 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_scraper.py Removed legacy scraper thumbnail tests (moved under anyplotlib/tests/test_documentation/).
tests/test_plotbar_extras.py Removed legacy PlotBar extras tests (coverage appears redistributed across new test structure).
tests/test_plot2d_polish.py Removed legacy Plot2D polish/regression tests (parts moved into test_plot2d_api.py).
tests/test_plot1d_linestyle.py Removed legacy Plot1D linestyle tests (coverage appears redistributed).
tests/test_plot1d_extras.py Removed legacy Plot1D extras tests (coverage appears redistributed).
tests/test_panel_alignment.py Removed legacy panel alignment tests (merged into test_gridspec.py).
tests/test_inset_visual.py Removed legacy inset visual regression tests (merged into test_layouts/test_inset.py).
tests/test_imshow_params.py Removed legacy imshow parameter tests (coverage appears redistributed).
tests/test_imshow_extras.py Removed legacy Plot2D extras tests (coverage appears redistributed).
pyproject.toml Update pytest discovery path to anyplotlib/tests (requires follow-up for coverage/packaging implications).
anyplotlib/tests/test_plot3d/test_plot3d.py Added Plot3D construction/mutation/validation tests.
anyplotlib/tests/test_plot3d/init.py Added package init for Plot3D test subpackage.
anyplotlib/tests/test_plot2d/test_plot2d_api.py Added cross-cutting Plot* repr/API regression tests.
anyplotlib/tests/test_plot2d/test_pcolormesh.py Expanded/refined PlotMesh test coverage and reorganized file location.
anyplotlib/tests/test_plot2d/init.py Added package init for Plot2D test subpackage.
anyplotlib/tests/test_plot1d/init.py Added package init for Plot1D test subpackage.
anyplotlib/tests/test_markers/test_markers.py Added comprehensive marker system + helper API tests.
anyplotlib/tests/test_markers/init.py Added package init for markers test subpackage.
anyplotlib/tests/test_layouts/test_visual.py Updated visual regression tests; currently uses a baseline path that doesn’t match where baselines were added.
anyplotlib/tests/test_layouts/test_inset.py Added inset visual regression section; currently uses a baseline path that doesn’t match where baselines were added.
anyplotlib/tests/test_layouts/test_gridspec.py Extended GridSpec tests with panel alignment checks and PAD-constant documentation.
anyplotlib/tests/test_layouts/init.py Added package init for layouts test subpackage.
anyplotlib/tests/test_interactive/test_widgets.py Updated interactive widget tests and documentation within docstring.
anyplotlib/tests/test_interactive/test_callbacks.py Reorganized callback tests; refocused a section on Figure event routing.
anyplotlib/tests/test_interactive/init.py Added package init for interactive test subpackage.
anyplotlib/tests/test_documentation/test_sphinx_anywidget.py Added sphinx_anywidget smoke tests for directive/scraper/utils.
anyplotlib/tests/test_documentation/test_scraper.py Added scraper thumbnail tests; currently skips the whole module when Playwright is missing (blocking non-Playwright checks).
anyplotlib/tests/test_documentation/test_push_hook.py Added unit tests for _push()/_push_layout() traitlet state propagation.
anyplotlib/tests/test_documentation/test_bridge.py Added Playwright E2E tests for iframe messaging and full mock Pyodide boot bridge.
anyplotlib/tests/test_documentation/init.py Added package init for documentation test subpackage.
anyplotlib/tests/test_benchmarks/test_benchmarks.py Updated benchmark test imports to match new test package layout.
anyplotlib/tests/test_benchmarks/test_benchmarks_py.py Added pure-Python serialization performance benchmarks + baseline comparison.
anyplotlib/tests/test_benchmarks/baselines.json Added benchmark baseline data/metadata.
anyplotlib/tests/test_benchmarks/init.py Added package init for benchmarks test subpackage.
anyplotlib/tests/conftest.py Updated shared fixtures/util imports for new test package layout.
anyplotlib/tests/baselines/imshow_gradient.png Added/relocated baseline PNG for visual regression.
anyplotlib/tests/baselines/imshow_checkerboard.png Added/relocated baseline PNG for visual regression.
anyplotlib/tests/baselines/bar_basic.png Added/relocated baseline PNG for visual regression.
anyplotlib/tests/_png_utils.py Added PNG encode/decode + image diff utilities (minor cleanup needed).
anyplotlib/tests/init.py Added package init for the test package.
Comments suppressed due to low confidence (3)

pyproject.toml:55

  • Since tests were moved under anyplotlib/tests, the coverage config now treats them as in-scope code (source = ["anyplotlib"]) but omit = ["tests/*", ...] no longer matches. This will skew coverage (and may fail CI) unless you also omit anyplotlib/tests/* (and likely anyplotlib/tests/baselines/*). Separately, hatch will now package anyplotlib/tests into the wheel via packages = ["anyplotlib"]; if that’s not intended, add an explicit exclude to avoid shipping large baseline PNGs.
    anyplotlib/tests/test_layouts/test_visual.py:42
  • BASELINES points to anyplotlib/tests/test_layouts/baselines, but the baseline PNGs added in this PR live under anyplotlib/tests/baselines. As written, these visual regression tests will always hit the if not path.exists(): pytest.skip(...) path and won’t validate rendering in CI. Update the baseline directory (or move the PNGs) so the tests actually exercise the golden images.
    anyplotlib/tests/test_layouts/test_inset.py:282
  • BASELINES points to anyplotlib/tests/test_layouts/baselines, but the inset baseline PNGs in this PR are under anyplotlib/tests/baselines. With the current path, all visual inset checks will be skipped due to missing baselines. Point BASELINES at the shared baselines directory (or relocate the PNGs) so these regression tests run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +90 to +98
# ─────────────────────────────────────────────────────────────────────────────
# Section 2 — Dark-theme pixel validation (requires Playwright)
# ─────────────────────────────────────────────────────────────────────────────

pytest.importorskip("playwright", reason="playwright not installed")


class TestThumbnailDarkTheme:
"""Verify the top-left pixel of each thumbnail is dark-blue, matching the
@CSSFrancis CSSFrancis merged commit 70d0f42 into main May 11, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants