Skip to content

Commit 44e283b

Browse files
Make test_scenarioMujoco save scenario figures
1 parent 1122fc8 commit 44e283b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/tests/test_scenarioMujoco.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import importlib
2525

2626
import pytest
27+
from Basilisk.utilities import unitTestSupport
2728

2829
try:
2930
from Basilisk.simulation import mujoco
@@ -32,8 +33,9 @@
3233
except:
3334
couldImportMujoco = False
3435

36+
THIS_FOLDER = os.path.dirname(__file__)
3537
SCENARIO_FOLDER = os.path.join(
36-
os.path.dirname(__file__), "..", "..", "examples", "mujoco"
38+
THIS_FOLDER, "..", "..", "examples", "mujoco"
3739
)
3840
SCENARIO_FILES = [
3941
filename[:-3]
@@ -49,8 +51,11 @@
4951
@pytest.mark.scenarioTest
5052
def test_scenarios(scenario: str):
5153
module = importlib.import_module(scenario)
52-
module.run() # Every mujoco scenario should have a run function
54+
figures = module.run() # Every mujoco scenario should have a run function
5355

56+
if figures is not None:
57+
for pltName, plt in figures.items():
58+
unitTestSupport.saveScenarioFigure(f"{scenario}_{pltName}", plt, THIS_FOLDER)
5459

5560
if __name__ == "__main__":
5661
pytest.main([__file__])

0 commit comments

Comments
 (0)