Unit test for CLI mode #122
Conversation
Restarting yml for CI7
Dockerfile used to generate the control_images for unit tests
There was a problem hiding this comment.
Code Review
This pull request introduces a testing framework for rendering, adding configuration files, a Dockerfile, a script to generate test renders, and a Python test suite that uses image hashing to verify the outputs. The reviewer feedback is highly constructive and should be addressed: it identifies a potential TypeError in the test suite when the SPLASH_DIR environment variable is missing, suggests refactoring the repetitive test cases using pytest parameterization, points out an unused import in the rendering script, and recommends optimizing the Dockerfile build times by using shallow git clones.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
After checking gemini feedback, I approved them. Moreover, I forgot to mention in the original MR that each test checks three conditions (
|
This MR contains the base for unit testing in SPLASH. We have included a yml that runs after the build test. For now, the test is only run in a Debian 12.11 VM but could be expanded to include macOS. The CI installs the SPLASH version to be tested with the latest version of giza, then downloads a Phantom binary stellar simulation snapshot and generates a series of render images using some of the basic CLI options for SPLASH, namely:
These images are compared using perceptual hashing, which allows some flexibility in the numerical rigor of the testing, as oposed a methods such as checksum hashing. The control images were generated using a Docker image, and the corresponding Dockerfile can be found in
scriptsalong the script that runs SPLASH for the images generation. Some further tweaking of the Docker may be needed in the future, but this method should prevent issues with small differences in fonts or window sizes once a standard is set.The test is written in Python, using pytest as base. We also added a IntEnum class to define the tolerance in image differences: