Skip to content

Commit cd06587

Browse files
committed
Lighter tests.
1 parent 78c7ff9 commit cd06587

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

tests/test_rl.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
from simple_playgrounds.agents.controllers import Random
22
from simple_playgrounds.agents import BaseAgent
33
from simple_playgrounds import Engine
4-
from simple_playgrounds.agents.sensors import Touch
54
from simple_playgrounds.agents.parts import ForwardPlatform
65

76
from simple_playgrounds.playground import PlaygroundRegister
87

9-
from simple_playgrounds.playgrounds.empty import SingleRoom
10-
from simple_playgrounds.utils.position_utils import CoordinateSampler
118

129
def test_all_test_playgrounds_interactive():
1310

1411
agent = BaseAgent(controller=Random(), interactive=True, platform=ForwardPlatform)
1512

16-
for pg_name, pg_class in PlaygroundRegister.playgrounds['basic_rl'].items():
13+
for _, pg_class in PlaygroundRegister.playgrounds['basic_rl'].items():
1714
playground = pg_class()
1815

1916
playground.add_agent(agent, allow_overlapping=False)
2017

2118
print('Starting testing of ', pg_class.__name__)
2219

23-
engine = Engine(playground, time_limit=10000)
20+
engine = Engine(playground, time_limit=1000)
2421
engine.run()
2522
assert 0 < agent.position[0] < playground.size[0]
2623
assert 0 < agent.position[1] < playground.size[1]

tests/test_sensors.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
from simple_playgrounds.agents.sensors import RgbCamera, GreyCamera, Lidar,\
22
Touch, SemanticRay, SemanticCones, TopdownSensor
3-
from simple_playgrounds.agents.sensors.sensor import Sensor
3+
from simple_playgrounds.playgrounds.collection.test.test_scene_elements import Basics, Teleports, Interactives
44

55
from simple_playgrounds.agents.controllers import Random
66
from simple_playgrounds.agents import BaseAgent
77
from simple_playgrounds.agents.parts import ForwardPlatform
88
from simple_playgrounds import Engine
99

10-
from simple_playgrounds.playground import PlaygroundRegister
11-
1210

1311
def run_experiment_on_sensor(**sensor_config):
1412

@@ -28,7 +26,7 @@ def run_experiment_on_sensor(**sensor_config):
2826

2927
print('Testing of sensor params ', sensor_config)
3028

31-
for pg_name, pg_class in PlaygroundRegister.playgrounds['test'].items():
29+
for pg_class in [Basics, Teleports, Interactives, ]:
3230
playground = pg_class()
3331
playground.add_agent(agent)
3432

@@ -52,14 +50,15 @@ def test_default_sensors():
5250

5351
def test_parameter_sensors():
5452

55-
for resolution in [2, 16, 32]:
53+
for resolution in [2, 16]:
5654

57-
for range_sensor in [2, 100, 500]:
55+
for range_sensor in [2, 100]:
5856

59-
for fov in [2, 30, 90, 180, 360, 380]:
57+
for fov in [2, 180, 360, 380]:
6058

6159
run_experiment_on_sensor(resolution=resolution, max_range=range_sensor, fov=fov)
6260

61+
6362
def test_rgb_on_teleports():
6463

6564
agent = BaseAgent(controller=Random(), interactive=True, platform=ForwardPlatform)
@@ -68,7 +67,6 @@ def test_rgb_on_teleports():
6867
invisible_elements=agent.parts,
6968
))
7069

71-
from simple_playgrounds.playgrounds.collection import Teleports
7270
playground = Teleports()
7371
playground.add_agent(agent)
7472

0 commit comments

Comments
 (0)