Skip to content

Handle jointless-articulation warnings in USD tests - #3124

Merged
adenzler-nvidia merged 1 commit into
newton-physics:mainfrom
adenzler-nvidia:adenzler/jointless-articulation-strict-warnings
Jun 10, 2026
Merged

Handle jointless-articulation warnings in USD tests#3124
adenzler-nvidia merged 1 commit into
newton-physics:mainfrom
adenzler-nvidia:adenzler/jointless-articulation-strict-warnings

Conversation

@adenzler-nvidia

@adenzler-nvidia adenzler-nvidia commented Jun 10, 2026

Copy link
Copy Markdown
Member

Description

test_import_usd has several fixtures that intentionally import single-body (jointless) articulations. OpenUSD < 26.0 — the usd-exchange build resolved on aarch64 — reports an articulation root with no joints as an invalid ArticulationDesc, so parse_usd emits a UserWarning; usd-core >= 26.0 (every other platform) treats it as valid. Newton imports the body identically either way, so these tests pass today, but they fail on aarch64 only once the suite escalates newton.* warnings to errors (the upcoming --strict-warnings mode in #3044).

Changes:

  • Drop the unnecessary ArticulationRootAPI from the parsing fixtures that only used it as scaffolding around a single body (material / contact response / gap / margin / solref / mujoco-options). They do not test articulations.
  • For the composition and parent-offset fixtures, where the articulation is the behavior under test, assert exactly the expected warning on OpenUSD < 26.0 (scoped by Usd.GetVersion()), while leaving every other warning subject to the ambient policy so an unexpected newton.* warning still fails under strict mode.
  • Tighten test_contact_response_legacy_shape_fallback: replace the blanket simplefilter("always"), which masked every warning, with a DeprecationWarning-scoped filter, and exact-match the per-attribute migration messages instead of substring-matching.

This is preparatory cleanup with no behavior change on main (the warning is non-fatal without --strict-warnings), so #3044 can go green on aarch64.

Checklist

  • New or existing tests cover these changes
  • The documentation is up to date with these changes
  • CHANGELOG.md has been updated (if user-facing change) — not applicable, test-only

Test plan

Verified on both USD builds by simulating #3044's strict filters (filterwarnings("error", category=DeprecationWarning) and filterwarnings("error", module=r"newton(\.|$)")): on usd-core 26.0+ the affected tests pass and the _expect_* decorator is a no-op; on the usd-exchange (OpenUSD 25.5) build the parsing fixtures emit no warning, the decorated fixtures record and assert exactly the expected warning, and an unrelated warning still escalates.

uv run --extra dev -m newton.tests -k SampleAssets
uv run --extra dev -m newton.tests -k test_import_articulation_parent_offset

Summary by CodeRabbit

  • Tests
    • Updated test suite to handle OpenUSD version compatibility warnings (versions older than 26.0).
    • Refactored physics articulation tests to properly manage deprecation warnings with stricter validation.
    • Added helper mechanisms for version-specific warning handling in test infrastructure.

OpenUSD < 26.0 -- the usd-exchange build resolved on aarch64 -- reports
an articulation root that has no joints as an invalid ArticulationDesc,
so parse_usd emits a UserWarning; usd-core >= 26.0 treats it as valid.
Several test_import_usd fixtures intentionally import single-body
(jointless) articulations, which Newton parses identically either way.
This made them fail on aarch64 only once the suite escalates newton.*
warnings to errors.

Drop the unnecessary ArticulationRootAPI from the parsing fixtures that
only used it as scaffolding around a single body. For the composition
and parent-offset fixtures, where the articulation is the behavior under
test, assert exactly the expected warning on OpenUSD < 26.0 while leaving
every other warning subject to the ambient policy, so an unexpected
warning still surfaces.

Also tighten test_contact_response_legacy_shape_fallback: replace the
blanket simplefilter("always") with a DeprecationWarning-scoped filter
and exact-match the per-attribute migration messages.
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates newton/tests/test_import_usd.py to handle OpenUSD 26.0 compatibility by introducing a version-gated warning decorator for jointless articulations and adjusting test fixtures to either suppress or avoid the warning, alongside tightening deprecation warning assertions in legacy contact-response tests.

Changes

USD Warning and Articulation Handling

Layer / File(s) Summary
Version-gated jointless-articulation warning decorator
newton/tests/test_import_usd.py
New _expect_jointless_articulation_warning decorator conditionally captures and asserts a specific OpenUSD "invalid articulation desc" UserWarning when USD version < 26.0. The decorator is applied to eight tests that create jointless articulations: test_import_articulation_parent_offset, test_parent_body_attaches_to_existing_body, test_parent_body_with_base_joint_creates_d6, test_parent_body_creates_joint_to_parent, test_floating_true_with_parent_body_raises_error, test_floating_false_with_parent_body_succeeds, test_non_sequential_articulation_attachment, and test_three_level_hierarchical_composition.
ArticulationRootAPI removal and deprecation assertion tightening
newton/tests/test_import_usd.py
Eight test fixtures are modified to remove ArticulationRootAPI application and define their articulation setup as plain UsdGeom.Xform instead: test_parse_mujoco_options_disabled, test_material_parsing, test_contact_margin_parsing, test_contact_gap_parsing, test_contact_response_parsing, test_contact_response_inf_sentinel, test_contact_response_legacy_shape_fallback, and test_contact_response_solref_over_material. Additionally, test_contact_response_legacy_shape_fallback replaces broad warnings.simplefilter("always") with explicit warnings.filterwarnings("always", category=DeprecationWarning) and replaces loose substring-based checks with exact-message assertions counting each expected migration message to appear exactly twice.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • newton-physics/newton#3005: Both PRs update deprecation warning expectations in test_contact_response_legacy_shape_fallback for Newton's deprecated per-shape newton:contact_ke/contact_kd handling.

Suggested labels

usd

Suggested reviewers

  • vreutskyy
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: handling jointless-articulation warnings in USD tests, which is the core focus of the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
newton/tests/test_import_usd.py (1)

38-39: ⚡ Quick win

Avoid a Sphinx :func: link to private parse_usd.

Line 38 references :func:\~newton.utils.parse_usd`, but parse_usd is a private helper and not a stable public Sphinx target. Prefer inline code (``parse_usd()``) or reference the public entry point (ModelBuilder.add_usd`).

Based on learnings: parse_usd in newton/_src/utils/import_usd.py is private and should not be referenced via Sphinx :func: targets; use inline code literals instead. As per coding guidelines, use Sphinx cross-references against public API paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@newton/tests/test_import_usd.py` around lines 38 - 39, Replace the Sphinx
:func: cross-reference to the private helper parse_usd with an inline code
literal or a public API reference: change ":func:`~newton.utils.parse_usd`" to
"``parse_usd()``" or to the public entry point ":meth:`ModelBuilder.add_usd`" so
the docs do not point to the private function parse_usd (the helper in
import_usd.py) and instead reference a stable public target.

Sources: Coding guidelines, Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@newton/tests/test_import_usd.py`:
- Around line 38-39: Replace the Sphinx :func: cross-reference to the private
helper parse_usd with an inline code literal or a public API reference: change
":func:`~newton.utils.parse_usd`" to "``parse_usd()``" or to the public entry
point ":meth:`ModelBuilder.add_usd`" so the docs do not point to the private
function parse_usd (the helper in import_usd.py) and instead reference a stable
public target.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 664d4233-9eda-4859-ae2b-ef5c99f3cf8c

📥 Commits

Reviewing files that changed from the base of the PR and between 839284a and 17e7bcb.

📒 Files selected for processing (1)
  • newton/tests/test_import_usd.py

@adenzler-nvidia
adenzler-nvidia requested a review from nvtw June 10, 2026 13:50
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@adenzler-nvidia
adenzler-nvidia added this pull request to the merge queue Jun 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jun 10, 2026
@adenzler-nvidia
adenzler-nvidia added this pull request to the merge queue Jun 10, 2026
Merged via the queue into newton-physics:main with commit a9151ef Jun 10, 2026
25 checks passed
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.

2 participants