Skip to content

Conversation

@thomas-tu
Copy link
Collaborator

Purpose of this PR

[Brief summary of the changes in this PR.]

Links

Jira:

Comments to Reviewers

[List known issues, planned work, provide any extra context for your code.]

@u-pr-agent
Copy link

u-pr-agent bot commented Nov 18, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪

The PR contains a single-line change in a test file, which is straightforward to understand and review.
🏅 Score: 65

The change weakens a test by ignoring all potential errors instead of specifically expecting known ones, which could hide future regressions.
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Weakened Test

Setting LogAssert.ignoreFailingMessages = true is overly broad and can mask legitimate, unexpected errors in the future. This makes the test less reliable. It's preferable to revert to using the more specific LogAssert.Expect to target only the known, expected error messages. If the error messages are unstable, consider using a regular expression with LogAssert.Expect.

UnityEngine.TestTools.LogAssert.ignoreFailingMessages = true;
  • Update review

🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent

Copy link
Contributor

@varinotmUnity varinotmUnity left a comment

Choose a reason for hiding this comment

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

lgtm. Should we also UnityEngine.TestTools.LogAssert.ignoreFailingMessages = false; in the cleanup of this file, and the facePicker one?

Comment on lines 273 to 276
UnityEngine.TestTools.LogAssert.ignoreFailingMessages = true;
EditorSceneViewPicker.DoMouseClick(
CreateMouseEvent(mousePos, EventType.MouseDown, EventModifiers.None),
SelectMode.Edge,
Copy link

Choose a reason for hiding this comment

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

Suggestion: The LogAssert.ignoreFailingMessages flag is a static property that persists across tests. Failing to reset it can cause subsequent tests to unintentionally ignore critical errors. To prevent this side effect, you should restore its original value using a try...finally block, ensuring it's always reset even if the test action throws an exception. [possible issue, importance: 9]

New proposed code:
+var previousIgnoreFailingMessages = UnityEngine.TestTools.LogAssert.ignoreFailingMessages;
 UnityEngine.TestTools.LogAssert.ignoreFailingMessages = true;
-EditorSceneViewPicker.DoMouseClick(
-    CreateMouseEvent(mousePos, EventType.MouseDown, EventModifiers.None),
-    SelectMode.Edge,
-    m_PickerPreferences);
+try
+{
+    EditorSceneViewPicker.DoMouseClick(
+        CreateMouseEvent(mousePos, EventType.MouseDown, EventModifiers.None),
+        SelectMode.Edge,
+        m_PickerPreferences);
+}
+finally
+{
+    UnityEngine.TestTools.LogAssert.ignoreFailingMessages = previousIgnoreFailingMessages;
+}

🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent


UnityEngine.TestTools.LogAssert.Expect("Handles.GetClosestPickingID called outside an editor OnGUI");
UnityEngine.TestTools.LogAssert.Expect("Assertion failed on expression: 'device.IsInsideFrame()'");
UnityEngine.TestTools.LogAssert.ignoreFailingMessages = true;
Copy link

Choose a reason for hiding this comment

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

Suggestion: Using LogAssert.ignoreFailingMessages = true is risky as it can hide new, unexpected errors, reducing the test's effectiveness. A more robust approach is to explicitly declare the expected log messages using LogAssert.Expect. The original approach was likely failing because the LogType was not specified; assertion failures, for example, should be expected with LogType.Assert. [general, importance: 10]

Suggested change
UnityEngine.TestTools.LogAssert.ignoreFailingMessages = true;
// Please adjust the LogType to match the actual log message type.
UnityEngine.TestTools.LogAssert.Expect(LogType.Warning, "Handles.GetClosestPickingID called outside an editor OnGUI");
UnityEngine.TestTools.LogAssert.Expect(LogType.Assert, "Assertion failed on expression: 'device.IsInsideFrame()'");

🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent

@codecov-git.colasdn.top
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

@@           Coverage Diff           @@
##           master     #637   +/-   ##
=======================================
  Coverage   35.55%   35.55%           
=======================================
  Files         277      277           
  Lines       34889    34889           
=======================================
  Hits        12406    12406           
  Misses      22483    22483           
🚀 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.

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