IsaacLab icon indicating copy to clipboard operation
IsaacLab copied to clipboard

Transfer tests from unittest to pytest

Open pascal-roth opened this issue 10 months ago • 5 comments

Description

Started to transition tests from unittest to pytest and add new tests.

To run the tests, there are two options, either run for, e.g. the isaaclab test:

./isaaclab.sh -p -m pytest source/isaaclab/test  # all tests
./isaaclab.sh -p -m pytest source/isaaclab/test/sensors/test_ray_caster.py  # single test

or you can rerun the setup_vscode task which will automatically add two new run options (to either run a single test file or all tests):

Screenshot from 2025-04-09 10-32-15

TODO:

  • test_contact_sensor need cleanup with definition of parameterizations to avoid for loops
  • test_tiled_camera_env needs a long time -- is that intended? @kellyguo11

Type of change

  • New feature (non-breaking change which adds functionality)

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist

  • [x] I have run the pre-commit checks with ./isaaclab.sh --format
  • [ ] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • [x] I have added my name to the CONTRIBUTORS.md or my name already exists there

pascal-roth avatar Mar 06 '25 21:03 pascal-roth

We should also integrate Pytest-HTML to get a ncier logging of the test failures.

https://github.com/pytest-dev/pytest-html

@kellyguo11 do you know someone who can help check this?

Mayankm96 avatar Mar 17 '25 17:03 Mayankm96

We should also integrate Pytest-HTML to get a ncier logging of the test failures.

https://github.com/pytest-dev/pytest-html

@kellyguo11 do you know someone who can help check this?

I'll keep it on the list, we might not have bandwidth for now though.

kellyguo11 avatar Mar 17 '25 18:03 kellyguo11

Can you comment on how you run these pytests in the description :pray:

jsmith-bdai avatar Apr 08 '25 18:04 jsmith-bdai

@jsmith-bdai thanks for the feedback, all should be adjusted now

pascal-roth avatar Apr 09 '25 08:04 pascal-roth

@jsmith-bdai thanks for the feedback, all should be adjusted now

@pascal-roth when I try running the ./isaaclab.sh -p -m pytest source/isaaclab/test it fails locally in the docker during discovery due to ValueError: AppLauncer instance exists but enable_cameras is False. When you were testing this out were you operating in the docker?

jtigue-bdai avatar Apr 25 '25 18:04 jtigue-bdai

merged with #2034

pascal-roth avatar May 14 '25 06:05 pascal-roth