-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add kittest.toml config file
#7643
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
base: main
Are you sure you want to change the base?
Conversation
lucasmerlin
commented
Oct 16, 2025
- part of Make it easier to update kittest images rerun-io/rerun#10991
|
Preview available at https://egui-pr-preview.github.io/pr/7643-lucaskittest-toml View snapshot changes at kitdiff |
|
|
||
| [mac] | ||
| # Since our CI runs snapshot tests on macOS, this is our source of truth. | ||
| threshold = 0.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried to go lower here, but the redering test fails with a 0.6 between CI mac and my mac. The other tests are fine with 0.1 though
|
|
||
| loop { | ||
| // Check if Cargo.toml exists in this directory | ||
| if current_dir.join("Cargo.lock").exists() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we look for the first parent with a kittest.toml in it? 🤷
| let config_path = project_root.join("kittest.toml"); | ||
| if config_path.exists() { | ||
| let config_str = | ||
| std::fs::read_to_string(config_path).expect("Failed to read config file"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error should mention the path
| std::fs::read_to_string(config_path).expect("Failed to read config file"); | ||
| match toml::from_str(&config_str) { | ||
| Ok(config) => return config, | ||
| Err(e) => panic!("Failed to parse config file: {e}"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error should mention the path
| } | ||
|
|
||
| impl Config { | ||
| pub fn get() -> &'static Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docstring!
Also, maybe call this fn global or workspace or something for clarity?
| /// The output path for image snapshots. | ||
| /// | ||
| /// Default is "tests/snapshots". | ||
| pub fn output_path(&self) -> PathBuf { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To where is the path relative?
| Config::default() | ||
| } | ||
|
|
||
| pub fn config() -> &'static Config { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docstring
| impl Default for OsThreshold<usize> { | ||
| /// Returns the default `failed_pixel_count_threshold` as configured in `kittest.toml` | ||
| /// | ||
| /// The default is `0`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the default whatever is in kittest.toml?
| impl Default for OsThreshold<f32> { | ||
| /// Returns the default `threshold` as configured in `kittest.toml` | ||
| /// | ||
| /// The default is `0.6`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
| @@ -0,0 +1,10 @@ | |||
| output_path = "tests/snapshots" | |||
|
|
|||
| # Other oses get a higher threshold so they can still run tests locally without failures due to small rendering | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Other oses get a higher threshold so they can still run tests locally without failures due to small rendering | |
| # Other OSes get a higher threshold so they can still run tests locally without failures due to small rendering |