Skip to content

Migrate hdr tests to pytest - #15036

Merged
Nir-Az merged 3 commits into
realsenseai:developmentfrom
Nir-Az:migrate-hdr-pytest
May 10, 2026
Merged

Nir-Az merged 3 commits into
realsenseai:developmentfrom
Nir-Az:migrate-hdr-pytest

Conversation

@Nir-Az

@Nir-Az Nir-Az commented May 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Migrates the four unit-tests/live/hdr/ files to pytest:

  • test-hdr-configurations.py → pytest-hdr-configurations.py — parametrized: 5 configs × 3 resolutions = 15 instances + 1 standalone test_disable_auto_hdr
  • test-hdr-performance.py → pytest-hdr-performance.py — single function; removed count/count_frames globals in favor of a small FrameCounter class
  • test-hdr-preset.py → pytest-hdr-preset.py — split into test_hdr_preset_manual + test_hdr_preset_auto
  • hdr_helper.py — conservative refactor: kept module-level globals (am, sensor, pipe, batch_size); added setup_for_device(test_device) to populate them at test start. Function signatures unchanged. test.check(...) / test.closure(...) → pytest_check.check.* / log.info(...) (soft asserts so per-frame loop failures all surface)

Per-platform device selection

Legacy #test:device:jetson D457 / #test:device:!jetson D455 directives translated using rspy.pytest.device_helpers.is_jetson_platform:

pytestmark = [pytest.mark.device("D457" if is_jetson_platform() else "D455")]

Test plan (verified locally on D455)

  • pytest-hdr-preset.py::test_hdr_preset_manual PASS (~12s)
  • pytest-hdr-preset.py::test_hdr_preset_auto PASS (~12s)
  • pytest-hdr-configurations.py::test_hdr_configurations[640x480-cfg1] PASS
  • pytest-hdr-configurations.py::test_disable_auto_hdr PASS
  • pytest-hdr-performance.py::test_hdr_performance PASS (~63s, 5 configs)
  • Full nightly libci run (15 parametrized configs × 3 resolutions)

Nightly build
https://rsjenkins.realsenseai.com/job/LRS_libci_pipeline/15632/

🤖 Generated with Claude Code

@Nir-Az Nir-Az left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[rs-agentic bot] Automated review of PR #15036 — Migrate HDR tests to pytest

Overall the migration is clean and follows the pytest-infra skill guidelines well. Identified several BUGs and enhancements inline below. No Copilot reviewer assigned — proceeding with automated review.

Comment thread unit-tests/live/hdr/hdr_helper.py Resolved
Comment thread unit-tests/live/hdr/hdr_helper.py Resolved
Comment thread unit-tests/live/hdr/hdr_helper.py Resolved
Comment thread unit-tests/live/hdr/hdr_helper.py Resolved
@Nir-Az

Nir-Az commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

[rs-agentic bot] Additional review notes (non-inline)


1. 🔧 Guideline violation — git mv not used for test-hdr-configurations.py and test-hdr-performance.py

Per the pytest-infra skill step 2:

Rename with git mv: git mv test-foo.py pytest-foo.py (preserves history)

pytest-hdr-preset.py is correctly shown as a rename (git history preserved). However, pytest-hdr-configurations.py and pytest-hdr-performance.py appear as a delete + add pair, which loses the commit history for those files. Please amend the commit to use git mv so git log --follow works correctly for future debugging.


2. 🔧 Verify pytest_check is registered in rspy/pytest/plugins.py

The new files import from pytest_check import check. Per the pytest-infra skill:

When adding a pytest plugin to unit-tests/requirements.txt, you must also register it in rspy/pytest/plugins.py under REQUIRED_PYTEST_PLUGINS. … a missing plugin silently disables its CLI options … The registry makes the dependency explicit and fails loudly.

Please verify that pytest_check / pytest-check is already present in both requirements.txt and rspy/pytest/plugins.py. If not, add it to both.


3. ℹ️ Full nightly CI run still pending

The PR description notes the full 15-instance nightly run is unchecked. Recommend not merging until at least one complete libci nightly run passes on the target hardware (D455 non-Jetson, D457 Jetson), since the parametrized test_hdr_configurations matrix is the largest surface area change here.

@Nir-Az
Nir-Az requested a review from remibettan May 10, 2026 08:52
@Nir-Az
Nir-Az merged commit 254a6d3 into realsenseai:development May 10, 2026
30 checks passed
@Nir-Az
Nir-Az deleted the migrate-hdr-pytest branch May 11, 2026 15:21
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