pytest-infra
Skill9.1k starsChanged 27 days agoApache-2.0View on GitHub
Write a new librealsense pytest test (pytest-*.py) - markers, fixtures, assertions, FW gating, temp files - or change the pytest infrastructure (conftest.py, rspy/pytest). Use before adding a Python test or modifying conftest.py / rspy.
Trending
Steady talk.about the whole repository
Who's talking about realsenseai/librealsense
- NixOS/nixpkgs“librealsense: add missing support to udev rules”GitHub · Jan 6, 2026 · 2 reactions
- David-Martel/librealsense“fix(fw-update): stop device handles before logger teardown”GitHub · Jul 17, 2026 · 1 reactions
- Bradly187/Personal-Desktop-Agent“chore(deps): bump the python-minor-patch group across 1 directory with 8 updates”GitHub · Nov 2, 2026
- OpenGraphLabs/oglo-python“build(deps-dev): bump the python-dependencies group across 1 directory with 3 updates”GitHub · Nov 1, 2026
- huggingface/lerobot“docs: fix dead Isaac Teleop and RealSense links”GitHub · Oct 30, 2026
The biggest 5 of 34 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 34
Talked about on GitHub (34 times).
On GitHub · 34
- Jan 6, 2026librealsense: add missing support to udev rules — NixOS/nixpkgs2 reactions · 7 comments
- Jul 17, 2026fix(fw-update): stop device handles before logger teardown — David-Martel/librealsense1 reaction · 1 comment
- Nov 2, 2026chore(deps): bump the python-minor-patch group across 1 directory with 8 updates — Bradly187/Personal-Desktop-Agent0 reactions
- Nov 1, 2026build(deps-dev): bump the python-dependencies group across 1 directory with 3 updates — OpenGraphLabs/oglo-python0 reactions
- Oct 30, 2026docs: fix dead Isaac Teleop and RealSense links — huggingface/lerobot0 reactions · 1 comment
29 more on GitHub
- Oct 22, 2026build(deps): bump pyrealsense2 from 2.58.4.10922 to 2.59.1.11053 — nvidia-holoscan/holoscan-telesurgery0 reactions
- Oct 20, 2026[D585][GMSL_MUX] Support independent PD 15/30 FPS profiles — polejoe/librealsense0 reactions · 1 comment
- Oct 17, 2026Update pyrealsense2 requirement from >=2.55 to >=2.59.1.11053 — bnrohit/hybrid-rf-scanner0 reactions
- Oct 11, 2026librealsense 2.59.1 — Homebrew/homebrew-core0 reactions · 2 comments
- Oct 4, 2026pyrealsense2: Add version 2.58.4.10922 — riseproject-dev/python-wheels0 reactions · 1 comment
- Sep 23, 2026Add rocm-enabled librealsense package — gbionics/rock-the-conda0 reactions
- Sep 23, 2026Add librealsense — gbionics/rock-the-conda0 reactions · 3 comments
- Sep 14, 2026librealsense: update recipe to latest stable version 2.58.1 — conan-io/conan-center-index0 reactions · 1 comment
- Sep 14, 2026[RSDEV-14616] Use BA10 exclusively for D500 RGB calibration — realsenseai/realsense_mipi_platform_driver0 reactions · 3 comments
- Sep 5, 2026Update pyrealsense2 requirement from >=2.55 to >=2.58.4.10922 — bnrohit/hybrid-rf-scanner0 reactions · 1 comment
- Sep 2, 2026[RSDEV-14097] Expose D585 GMSL gyro sensitivity — realsenseai/realsense_mipi_platform_driver0 reactions
- Aug 31, 2026Package rocm variant of librealsense — conda-forge/librealsense-feedstock0 reactions · 1 comment
- Aug 30, 2026librealsense 2.58.4 — Homebrew/homebrew-core0 reactions · 1 comment
- Aug 28, 2026Fix RVIZ Vizualization of the RealSense D435i Camera Stability and Performance Via ROS Network — arcs-tmu/laika0 reactions
- Aug 15, 2026Update pyrealsense2 requirement from >=2.55 to >=2.58.3.10794 — bnrohit/hybrid-rf-scanner0 reactions · 1 comment
- Aug 5, 2026RSDEV-13232 Integrate D500 stream-group runtime — ghu3/librealsense0 reactions · 4 comments
- Aug 5, 2026Bake ROS 2, RealSense, SiMa CLI, and GitHub tooling into the ARM64 SDK image — sima-vertical-solutions/ros2-sdk0 reactions
- Jul 20, 2026Add python3-pyrealsense2-pip rosdep key to python.yaml — ros/rosdistro0 reactions · 1 comment
- Jul 19, 2026librealsense 2.58.3 — Homebrew/homebrew-core0 reactions · 1 comment
- Jul 9, 2026Support launching Docker GUI apps from Fedora Wayland via XWayland — amoffat/librealsense0 reactions
- Jul 6, 2026Add D401 GMSL dual-RGB support (POC) — ashrafk93/librealsense0 reactions
- Jun 29, 2026chore(deps): bump pyrealsense2 from 2.58.1.10581 to 2.58.2.10647 — AliaksandrNazaruk/janus-camera-stack0 reactions · 1 comment
- Jun 24, 2026Ashraf/zerocopy pr1 — ashrafk93/librealsense0 reactions
- Jun 12, 2026Add placeholder workflow to register build-deb-packages trigger — locusrobotics/librealsense0 reactions
- Mar 11, 2026Add aligned depth topic for RGBD sensor — gazebosim/gz-sim0 reactions · 1 comment
- Feb 17, 2026`pixel_to_real_world` service fails in real mode due to missing `/camera/depth/camera_info` publisher — Final-Project-ROS2/vision0 reactions
- Jan 27, 2026Reliability of the AI-Autostart — A13k5-5/COMP0016_2025_Team11_no-ui-game0 reactions · 1 comment
- Jan 24, 2026[day 1] — z18k/AI-Vision-Learning0 reactions
- Dec 4, 2025[realsense2] update to v2.56.5 — microsoft/vcpkg0 reactions · 2 comments
In this repository9 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- add-apiSkill
- buildSkill
- cpp-codingSkill
- file-creationSkill
- pr-createSkill
- pr-reviewSkill
- testingSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
All Python tests run under pytest.
- Very specific: line 29
Location and name: put the file in the matching topic directory (e.g.
- Very specific: line 47
Don't add pytest.mark.live.
- Very specific: line 67
Don't wrap the test in try/except.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Pytest Tests & Infrastructure
When to Use This Skill
- Adding a new Python test (
pytest-*.py) underunit-tests/ - Modifying pytest infrastructure (
conftest.py,py/rspy/pytest/,py/rspy/devices.py, hub modules)
All Python tests run under pytest. run-unit-tests.py is kept only for C++ tests (see the testing skill).
Key Files
| File | Purpose |
unit-tests/conftest.py | Hooks, fixtures, CLI flags, marker registration, default 200s timeout |
py/rspy/pytest/device_helpers.py | Device parametrization (device_each), require_min_fw_version |
py/rspy/pytest/collection.py | Collection filtering: context gating, --live, priority ordering |
py/rspy/pytest/logging_setup.py | Per-test log files, terminal summary |
py/rspy/pytest/cli.py | Legacy CLI flag translation (e.g. -r → -k) |
py/rspy/pytest/plugins.py | Required pytest plugin registry |
py/rspy/devices.py | Device discovery, hub port control (enable_only()) |
Adding a New Test
- Location and name: put the file in the matching topic directory (e.g.
unit-tests/live/frames/) namedpytest-<name>.py. Start with the copyright header (current year). Pick markers (module-level
pytestmark = [...]or per test):Need Marker Any one matching device pytest.mark.device("D400*")Run once per matching device pytest.mark.device_each("D400*")Each device matching any of several patterns pytest.mark.device_each("D555", "D585")Several devices at once (with test_devices)pytest.mark.device("D400*", "D500*")Exclude SKUs pytest.mark.device_exclude("D401")Only / never on a connection type pytest.mark.device_type("GMSL")/pytest.mark.device_type_exclude("DDS")Nightly / weekly only pytest.mark.context("nightly")Needs a DDS build pytest.mark.ddsRun earlier / later (default 500) pytest.mark.priority(100)Longer than the 200s default pytest.mark.timeout(600)Known flaky pytest.mark.flaky(reruns=2)—reruns=, neverretries=(silently ignored, guarded by an infra test)- Exclude unsupported SKUs/transports with markers so they are skipped at collection — don't
pytest.skip()at runtime for that. - Don't add
pytest.mark.live;--livefiltering is derived from thedevicemarkers. - A new custom marker must be registered in
conftest.py:pytest_configure.
- Exclude unsupported SKUs/transports with markers so they are skipped at collection — don't
Pick the lowest fixture you need:
You need Fixture Device + context test_device→(dev, ctx)D585S in service mode (no-op for others) test_device_wrappedSeveral devices test_devices→([dev, ...], ctx)Only a context test_contextHub setup only, own context (e.g. DDS settings) module_device_setupActive --contexttagstest_context_varNo device none The first test in a file recycles the device via the hub; later tests in the file reuse it.
- Write the test body:
- Logging:
import logging; log = logging.getLogger(__name__). - Hard stop:
assert. To keep looping and report every failure:from pytest_check import check(check.equal,check.is_true,check.almost_equal(a, b, abs=tol)). - Minimum FW:
require_min_fw_version(dev, rsutils.version(5, 15, 0, 0), "FEATURE")fromrspy.pytest.device_helpers— no inline version checks. - Files written by the test go under the
tmp_pathfixture, nevertempfile.mkdtemp(). - Don't wrap the test in
try/except; let pytest report the exception. Expected exceptions:with pytest.raises(...). Test-scoped cleanup: ayieldfixture. If you must catch, keep the original error (raiseorpytest.fail(f"...: {e}")), neverexcept: pass. - Reuse helpers (
rspy.snippets,rspy.pytest.device_helpers) before writing new ones. Helper module names must be unique acrossunit-tests/(pytest imports all of them in one process). - A test that depends on an earlier one: the earlier test sets a flag in a module-level dict, dependents
pytest.skip()when it's missing.
- Logging:
- Run it locally from
unit-tests/:python -m pytest -v live/frames/pytest-<name>.py. Don't use-swhen you need the per-test log files.
Minimal example
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) <current year> RealSense, Inc. All Rights Reserved.
import pytest
import pyrealsense2 as rs
import logging
log = logging.getLogger(__name__)
pytestmark = [pytest.mark.device_each("D400*")]
def test_depth_streaming(test_device):
dev, ctx = test_device
pipe = rs.pipeline(ctx)
cfg = rs.config()
cfg.enable_stream(rs.stream.depth, rs.format.z16, 30)
pipe.start(cfg)
try:
frames = pipe.wait_for_frames()
finally:
pipe.stop()
assert frames.size() > 0Changing the Infrastructure
- Infra regression tests live in
unit-tests/infra-tests/. They mock the hardware (no camera or pyrealsense2 needed) and run on GHA for every PR. Every change toconftest.pyorpy/rspy/pytest/*.pymust passpython -m pytest infra-tests/ -v(fromunit-tests/), and every new infra feature (marker, CLI flag, skip/fail rule) needs a test there.test_e2e_*.pyfiles run real pytest subprocesses against the realconftest.pyviainfra-tests/helpers.py:run_e2e(). - New pytest plugin: pin it in
unit-tests/requirements.txtand add it toREQUIRED_PYTEST_PLUGINSinpy/rspy/pytest/plugins.py. A missing plugin otherwise silently disables its CLI options; the registry makespytest_configurefail loudly. - Hub ports:
CombinedHubnumbers ports across hubs (Acroname first, then UniFi).devices.enable_only()derives the enabled ports on every call — don't add a cache.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

