mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-26 03:50:44 -09:00
support/testing: add python-gymnasium tests
Add a basic runtime test for the python-gymnasium package. This test verifies the fundamental operations of the library by: - Importing `gymnasium`. - Creating a "CartPole-v1" environment. - Resetting the environment. - Taking a random action step. - Closing the environment. Signed-off-by: Xukai Wang <kingxukai@zohomail.com> [Julien: - sort DEVELOPERS entries alphabetically - fix file name typo in DEVELOPERS - remove selection of dependencies in test config ] Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
committed by
Julien Olivain
parent
6e6597de21
commit
b647b0c95d
@@ -3485,8 +3485,10 @@ F: package/python-farama-notifications/
|
||||
F: package/python-gymnasium/
|
||||
F: support/testing/tests/package/sample_python_cloudpickle.py
|
||||
F: support/testing/tests/package/sample_python_farama_notifications.py
|
||||
F: support/testing/tests/package/sample_python_gymnasium.py
|
||||
F: support/testing/tests/package/test_python_cloudpickle.py
|
||||
F: support/testing/tests/package/test_python_farama_notifications.py
|
||||
F: support/testing/tests/package/test_python_gymnasium.py
|
||||
|
||||
N: Yair Ben Avraham <yairba@protonmail.com>
|
||||
F: package/casync/
|
||||
|
||||
8
support/testing/tests/package/sample_python_gymnasium.py
Normal file
8
support/testing/tests/package/sample_python_gymnasium.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import gymnasium as gym
|
||||
env = gym.make("CartPole-v1")
|
||||
|
||||
observation, info = env.reset()
|
||||
random_action = env.action_space.sample()
|
||||
next_observation, reward, terminated, truncated, info = env.step(random_action)
|
||||
|
||||
env.close()
|
||||
12
support/testing/tests/package/test_python_gymnasium.py
Normal file
12
support/testing/tests/package/test_python_gymnasium.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from tests.package.test_python import TestPythonPackageBase
|
||||
|
||||
|
||||
class TestPythonPy3Gymnasium(TestPythonPackageBase):
|
||||
__test__ = True
|
||||
config = TestPythonPackageBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
BR2_PACKAGE_PYTHON_GYMNASIUM=y
|
||||
"""
|
||||
sample_scripts = ["tests/package/sample_python_gymnasium.py"]
|
||||
timeout = 20
|
||||
Reference in New Issue
Block a user