Skip to content
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

ViewerContext test harness 0.1 #6432

Merged
merged 7 commits into from
May 28, 2024
Merged

ViewerContext test harness 0.1 #6432

merged 7 commits into from
May 28, 2024

Conversation

abey79
Copy link
Member

@abey79 abey79 commented May 25, 2024

What

  • Make the render_context field of ViewerContext an Option to make it easier to crate a ViewerContext in a test environment.
  • Introduce a (very basic) test helper that creates a ViewerContext for use in unit test.
  • Demo unit test that attempts to run SelectionPanel::show_panel()

Chained to #6431

There are many improvements that could be added:

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!

To run all checks from main, comment on the PR with @rerun-bot full-check.

@abey79 abey79 added 🔨 testing testing and benchmarks exclude from changelog PRs with this won't show up in CHANGELOG.md 💬 discussion labels May 25, 2024
@abey79 abey79 force-pushed the antoine/re-selection-panel branch from 7d70f5d to 12fb2a1 Compare May 26, 2024 19:38
@abey79 abey79 force-pushed the antoine/fake-ctx-harness branch from 63d213b to e24d803 Compare May 26, 2024 19:40
@abey79 abey79 force-pushed the antoine/re-selection-panel branch from 12fb2a1 to adbc477 Compare May 27, 2024 10:01
@abey79 abey79 force-pushed the antoine/fake-ctx-harness branch from e24d803 to ceb1dce Compare May 27, 2024 10:01
Base automatically changed from antoine/re-selection-panel to main May 27, 2024 10:18
@abey79 abey79 force-pushed the antoine/fake-ctx-harness branch from ceb1dce to afd3a8f Compare May 27, 2024 10:19
@Wumpf Wumpf self-requested a review May 27, 2024 11:15
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

I wish we could instead have a "null context" on re_renderer, but that would be a lot more work I reckon. Not happy how we have to skip over so much code right now.
That said, approving it regardless since it's a huge improvement of what type of unit tests we can write 👍, TestContext and utility methods that we might add later to it will be invaluable

Comment on lines +215 to +217
let Some(render_ctx) = ctx.render_ctx else {
return Err(SpaceViewSystemExecutionError::NoRenderContextError);
};
Copy link
Member

Choose a reason for hiding this comment

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

I don't think there's a better way that's not super tricky to implement right now, but this kind of early out here makes this approach a lot less viable for benchmarks. It would be great if we could still some logic of the visualizers, at least including the queries

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. In this case though, literally the next line needs a render_ctx, and it can't be moved further down... 🤷

@@ -20,6 +20,7 @@ mod space_view;
mod store_context;
pub mod store_hub;
mod tensor;
pub mod test_context;
Copy link
Member

Choose a reason for hiding this comment

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

should be protected by cfg test?

Copy link
Member Author

Choose a reason for hiding this comment

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

It feels like it should, but then cargo clippy --all-features --all-targets fails. I'll leave a todo.

@abey79 abey79 merged commit 68a1061 into main May 28, 2024
35 checks passed
@abey79 abey79 deleted the antoine/fake-ctx-harness branch May 28, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💬 discussion exclude from changelog PRs with this won't show up in CHANGELOG.md 🔨 testing testing and benchmarks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants