mesa icon indicating copy to clipboard operation
mesa copied to clipboard

Integrate Visualization Testing in Mesa CI

Open EwoutH opened this issue 11 months ago • 5 comments

Goal

Add comprehensive testing for Mesa's visualization components (SolaraViz) to our CI pipeline to ensure visualization functionality works correctly across all example models.

What's Been Tried

  • Basic model testing exists in test_examples.py but doesn't validate visualization components
  • PR #2491 started testing example app initialization by importing and accessing app.page
  • PR #215 in mesa-examples attempted more thorough SolaraViz testing but encountered import issues

Current Status

  • No systematic testing of visualization functionality exists in our CI
  • No performance benchmarks for visualizations
  • Basic tests only confirm models run but don't verify visualization correctness
  • The viz.py approach shows promise but needs integration with existing test infrastructure

The Solara docs might be useful: Testing with Solara

Part of #2364.

EwoutH avatar Mar 23 '25 07:03 EwoutH

Hey @EwoutH, I would like some clarification on the 'visualization correctness' part you mention, does it mean correct model behaviour?

Sahil-Chhoker avatar May 04 '25 08:05 Sahil-Chhoker

I would like some clarification on the 'visualization correctness' part you mention, does it mean correct model behaviour?

I would say it means that what happens in the models is correctly visualized.

But don't overcomplicate this issue. Most important thing is that no runtime errors occur in example models. Currently we have zero example testing of visualisation, leading to frequent hard errors.

EwoutH avatar May 09 '25 19:05 EwoutH

If that's the case I think PR #2767 covers those cases pretty well.

Sahil-Chhoker avatar May 10 '25 05:05 Sahil-Chhoker

Hello @EwoutH Good Morning sir, i would like to work on this issue is it open or it has been merged?

Anshuprem avatar May 30 '25 00:05 Anshuprem

Hi everyone,

I was just working on issue #2535 (PR #2871) and @EwoutH pointed out that the bug I fixed wasn't caught by the current CI.

What I found is that our current ReadTheDocs CI for tutorials successfully runs the 0_first_model.ipynb notebook. However, the MoneyModel defined in that tutorial fails with a ValueError: Missing required model parameter: "n" if you try to pass it to ModelPage(MoneyModel) from Solara, because it's missing default parameter values.

The CI doesn't test this "visualization" step, it only tests if the notebook runs on its own. It would be great if our CI could also try to render the tutorial models with ModelPage to catch this kind of visualization-specific bug in the future.

pragam-m25 avatar Nov 02 '25 12:11 pragam-m25