Skip to content

[Proposal] Promote the shared environment-test helpers into the installed surface #7488

Open

Description

@AntoineRichard

Proposal

Promote the reusable environment- and rendering-test helpers that currently live at the root of source/isaaclab_tasks/test/ into the installed surface — for example an isaaclab_tasks.testing module — so in-tree suites and external projects generated by the template import the same code. Test files would stay unshipped; only the reusable helpers move.

Concretely, the two files in question on develop:

File Lines Provides In-tree importers
source/isaaclab_tasks/test/env_test_utils.py 429 setup_environment, _run_environments, SINGLE_ENVIRONMENT_TASKS, XFAIL_TASKS 5
source/isaaclab_tasks/test/rendering_test_utils.py 2524 rendering / golden-image harness 22

27 in-tree files total would re-point their imports (no file imports both). They currently reach the helpers through a sys.path hack in source/isaaclab_tasks/test/conftest.py:

sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

with the docstring "Adds this directory to sys.path so tests located in the core/ and contrib/ sub-directories can import the shared helpers".

Motivation

The helpers are not importable outside the source checkout. test/ is a sibling of the package directory:

source/isaaclab_tasks/
├── isaaclab_tasks/
├── test/            <- env_test_utils.py, rendering_test_utils.py live here
└── pyproject.toml

and packaging includes only the package:

[tool.setuptools.packages.find]
where = ["."]
include = ["isaaclab_tasks", "isaaclab_tasks.*"]

That is the right layout for test files — nobody wants the suite in the wheel — but it takes the reusable helpers down with it.

The lived consequence: I ported a 14-task locomotion family (MicroDuck, 19 test files / 598 tests) into a project generated by isaaclab --new, per the doc being added in #7480. All 14 environment smoke tests failed at collection with

ModuleNotFoundError: No module named 'env_test_utils'

env_test_utils only depends on isaaclab and isaaclab_tasks, both of which the generated project already has, so vendoring a copy worked — but that copy is now a fork that will silently drift from upstream. Any project generated from the template that wants environment smoke coverage hits the same wall and makes the same fork.

There's a second signal, and it is a slightly awkward one. Six shipped config files under isaaclab_tasks/contrib/ carry comments pointing at the helper, e.g.

# Marker consumed by ``env_test_utils._is_teleop_env`` to bucket teleop

_is_teleop_env no longer exists in env_test_utils.py on develop — so shipped code documents a contract with a private function of a module it cannot import, and the reference has already rotted without anything catching it. Whatever the fix here, that coupling would be far easier to keep honest across a public import path. (Happy to file the stale comments separately if that's preferred.)

The sys.path trick is also straining in-tree: source/isaaclab_visualizers/test/ and tools/test_settings.py refer to rendering_test_utils in prose rather than importing it, because the conftest.py path insertion does not reach across the package boundary.

Context: #7480 adds "Build your own project or task", which documents the external-project workflow but says nothing about tests. Whichever way this proposal lands, that doc should either point at a packaged home for the helpers or state plainly that projects must vendor them and own the drift.

Alternatives

  • Status quo — every external project vendors a copy. Works today (that is what the MicroDuck port does), but every consumer forks 429 lines and no one learns when upstream changes them.
  • Ship test/ in the wheel. Puts the whole suite, its fixtures and its goldens in every install. Worse than the problem.
  • A separate isaaclab-testing distribution. Cleaner boundary, but a new package to version and release for two files.
  • Document the vendoring as expected. Cheapest, and worth doing regardless as a stopgap, but it makes drift policy rather than accident.

Build Info

  • Isaac Lab Version: develop @ 13296b1 (also reproduced against 21.0.1 from the source tree)
  • Isaac Sim Version: not required — reproduced in a kit-less Newton environment

Additional context

The scope is deliberately small: move two files, add a public import path, re-point 27 in-tree imports, and drop the sys.path.insert from conftest.py. Naming is open — isaaclab_tasks.testing reads well next to isaaclab_tasks.utils, but anything importable works.

Checklist

  • I have checked that there is no similar issue in the repo (required)

Acceptance Criteria

  • The reusable environment/rendering test helpers are importable from an installed isaaclab_tasks (no sys.path manipulation required)
  • The 27 in-tree consumers import them through the public path and the suite still passes
  • Test files, fixtures and goldens remain unshipped
  • The "Build your own project or task" doc ([Workflow] Fix template generator in uv environments #7480) tells external projects how to reuse them

Activity

  1. Saibernard commented on Sep 3, 2026

    @Saibernard

    Hi,

    I can take this one if it is not already in progress on your side. I would follow the layout in the proposal, isaaclab_tasks.testing with the two helper modules, re-point the 27 in-tree imports and drop the sys.path insert from the tasks conftest. One question before I start. The helpers import pytest at module level, so I would keep those imports inside the functions that need them, or guard them, so that installing isaaclab_tasks does not pull pytest in. Let me know if you would rather have a testing extra instead.

  2. added
    enhancement
    on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions