-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_examples.py
170 lines (155 loc) · 4.65 KB
/
test_examples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Copyright (c) Meta Platforms, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import itertools
from os import path as osp
import pytest
import habitat_sim.bindings
from utils import run_main_subproc
def powerset(iterable):
s = list(iterable)
return itertools.chain.from_iterable(
itertools.combinations(s, r) for r in range(len(s) + 1)
)
@pytest.mark.gfxtest
@pytest.mark.skipif(
not osp.exists("data/scene_datasets/habitat-test-scenes/skokloster-castle.glb")
or not osp.exists("data/scene_datasets/habitat-test-scenes/van-gogh-room.glb"),
reason="Requires the habitat-test-scenes",
)
@pytest.mark.skipif(
not habitat_sim.bindings.built_with_bullet,
reason="Bullet physics used for validation.",
)
@pytest.mark.parametrize(
"args",
[
(
"examples/tutorials/nb_python/ECCV_2020_Interactivity.py",
"--no-make-video",
"--no-display",
),
(
"examples/tutorials/nb_python/ECCV_2020_Advanced_Features.py",
"--no-make-video",
"--no-display",
),
],
)
def test_example_modules_required_bullet(args):
run_main_subproc(args)
@pytest.mark.gfxtest
@pytest.mark.skipif(
not osp.exists("data/scene_datasets/habitat-test-scenes/skokloster-castle.glb")
or not osp.exists("data/scene_datasets/habitat-test-scenes/van-gogh-room.glb"),
reason="Requires the habitat-test-scenes",
)
@pytest.mark.parametrize(
"args",
[
(
"examples/tutorials/nb_python/asset_viewer.py",
"--no-show-video",
"--no-make-video",
),
("examples/tutorials/stereo_agent.py", "--no-display"),
("examples/tutorials/lighting_tutorial.py", "--no-show-images"),
(
"examples/tutorials/nb_python/managed_rigid_object_tutorial.py",
"--no-show-video",
"--no-make-video",
),
("examples/tutorials/new_actions.py",),
(
"examples/tutorials/nb_python/ECCV_2020_Navigation.py",
"--no-make-video",
"--no-display",
),
(
"examples/tutorials/nb_python/replay_tutorial.py",
"--no-show-video",
"--no-make-video",
),
("examples/tutorials/semantic_id_tutorial.py", "--no-show-images"),
("examples/tutorials/async_rendering.py",),
],
)
def test_example_modules_optional_bullet(args):
run_main_subproc(args)
@pytest.mark.skipif(
not habitat_sim.bindings.built_with_bullet,
reason="Bullet physics required for ReplicaCAD Articulated Objects.",
)
@pytest.mark.skipif(
not osp.exists("data/replica_cad/"),
reason="Requires ReplicaCAD dataset.",
)
@pytest.mark.parametrize(
"args",
[
(
"examples/tutorials/nb_python/ReplicaCAD_quickstart.py",
"--no-show-video",
"--no-make-video",
)
],
)
def test_replica_cad_quickstart(args):
run_main_subproc(args)
@pytest.mark.gfxtest
@pytest.mark.skipif(
not osp.exists("data/scene_datasets/habitat-test-scenes/skokloster-castle.glb"),
reason="Requires the habitat-test-scenes",
)
@pytest.mark.skipif(
not habitat_sim.bindings.built_with_bullet,
reason="Bullet physics used for validation.",
)
@pytest.mark.parametrize(
"args",
[
["examples/example.py"] + list(p)
for p in powerset(
[
"--compute_shortest_path",
"--compute_action_shortest_path",
"--enable_physics",
"--semantic_sensor",
"--depth_sensor",
"--recompute_navmesh",
]
)
if not (("--compute_action_shortest_path" in p) and ("--enable_physics" in p))
],
ids=str,
)
def test_example_script_with_bullet(args):
run_main_subproc(args)
# Perform tests without physics enabled flag if no bullet, skip these if bullet exists
@pytest.mark.gfxtest
@pytest.mark.skipif(
not osp.exists("data/scene_datasets/habitat-test-scenes/skokloster-castle.glb"),
reason="Requires the habitat-test-scenes",
)
@pytest.mark.skipif(
habitat_sim.bindings.built_with_bullet,
reason="",
)
@pytest.mark.parametrize(
"args",
[
["examples/example.py"] + list(p)
for p in powerset(
[
"--compute_shortest_path",
"--compute_action_shortest_path",
"--semantic_sensor",
"--depth_sensor",
"--recompute_navmesh",
]
)
],
ids=str,
)
def test_example_script_no_bullet(args):
run_main_subproc(args)