Skip to content

Commit

Permalink
Add test for example scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneteoh committed Jun 13, 2024
1 parent dd0baf7 commit 43423de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/rlbench_gym.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import gymnasium as gym
from gymnasium.utils.performance import benchmark_step
import rlbench.gym

env = gym.make('rlbench/reach_target-vision-v0', render_mode="rgb_array")

Expand Down
15 changes: 15 additions & 0 deletions tests/unit/test_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pytest
from pathlib import Path

@pytest.fixture
def root_dir():
return Path(__file__).parents[2]

@pytest.fixture(autouse=True)
def chdir_to_root(root_dir, monkeypatch):
monkeypatch.chdir(root_dir)

@pytest.mark.parametrize("script_file", ["rlbench_gym.py", "rlbench_gym_vector.py"])
def test_example(script_file):
import subprocess
subprocess.run(["python", f"examples/{script_file}"], check=True)

0 comments on commit 43423de

Please sign in to comment.