|
9 | 9 | import pytest
|
10 | 10 | import torch
|
11 | 11 | from _utils_internal import get_available_devices, generate_seeds
|
12 |
| -from hydra import initialize, compose |
13 |
| -from hydra.core.config_store import ConfigStore |
| 12 | + |
| 13 | +try: |
| 14 | + from hydra import initialize, compose |
| 15 | + from hydra.core.config_store import ConfigStore |
| 16 | + |
| 17 | + _has_hydra = True |
| 18 | +except ImportError: |
| 19 | + _has_hydra = False |
14 | 20 | from mocking_classes import (
|
15 | 21 | ContinuousActionConvMockEnvNumpy,
|
16 | 22 | ContinuousActionVecMockEnv,
|
@@ -49,6 +55,7 @@ def _assert_keys_match(td, expeceted_keys):
|
49 | 55 |
|
50 | 56 |
|
51 | 57 | @pytest.mark.skipif(not _has_gym, reason="No gym library found")
|
| 58 | +@pytest.mark.skipif(not _has_hydra, reason="No hydra library found") |
52 | 59 | @pytest.mark.parametrize("device", get_available_devices())
|
53 | 60 | @pytest.mark.parametrize("noisy", [tuple(), ("noisy=True",)])
|
54 | 61 | @pytest.mark.parametrize("distributional", [tuple(), ("distributional=True",)])
|
@@ -99,6 +106,7 @@ def test_dqn_maker(device, noisy, distributional, from_pixels):
|
99 | 106 | proof_environment.close()
|
100 | 107 |
|
101 | 108 |
|
| 109 | +@pytest.mark.skipif(not _has_hydra, reason="No hydra library found") |
102 | 110 | @pytest.mark.skipif(not _has_gym, reason="No gym library found")
|
103 | 111 | @pytest.mark.parametrize("device", get_available_devices())
|
104 | 112 | @pytest.mark.parametrize("from_pixels", [("from_pixels=True", "catframes=4"), tuple()])
|
@@ -173,6 +181,7 @@ def test_ddpg_maker(device, from_pixels, gsde, exploration):
|
173 | 181 | del proof_environment
|
174 | 182 |
|
175 | 183 |
|
| 184 | +@pytest.mark.skipif(not _has_hydra, reason="No hydra library found") |
176 | 185 | @pytest.mark.skipif(not _has_gym, reason="No gym library found")
|
177 | 186 | @pytest.mark.parametrize("device", get_available_devices())
|
178 | 187 | @pytest.mark.parametrize("from_pixels", [tuple(), ("from_pixels=True", "catframes=4")])
|
@@ -287,11 +296,12 @@ def test_ppo_maker(device, from_pixels, shared_mapping, gsde, exploration):
|
287 | 296 | del proof_environment
|
288 | 297 |
|
289 | 298 |
|
| 299 | +@pytest.mark.skipif(not _has_hydra, reason="No hydra library found") |
| 300 | +@pytest.mark.skipif(not _has_gym, reason="No gym library found") |
290 | 301 | @pytest.mark.parametrize("device", get_available_devices())
|
291 | 302 | @pytest.mark.parametrize("gsde", [tuple(), ("gSDE=True",)])
|
292 | 303 | @pytest.mark.parametrize("from_pixels", [tuple()])
|
293 | 304 | @pytest.mark.parametrize("tanh_loc", [tuple(), ("tanh_loc=True",)])
|
294 |
| -@pytest.mark.skipif(not _has_gym, reason="No gym library found") |
295 | 305 | @pytest.mark.parametrize("exploration", ["random", "mode"])
|
296 | 306 | def test_sac_make(device, gsde, tanh_loc, from_pixels, exploration):
|
297 | 307 | if not gsde and exploration != "random":
|
@@ -402,10 +412,11 @@ def test_sac_make(device, gsde, tanh_loc, from_pixels, exploration):
|
402 | 412 | del proof_environment
|
403 | 413 |
|
404 | 414 |
|
| 415 | +@pytest.mark.skipif(not _has_hydra, reason="No hydra library found") |
| 416 | +@pytest.mark.skipif(not _has_gym, reason="No gym library found") |
405 | 417 | @pytest.mark.parametrize("device", get_available_devices())
|
406 | 418 | @pytest.mark.parametrize("from_pixels", [tuple(), ("from_pixels=True", "catframes=4")])
|
407 | 419 | @pytest.mark.parametrize("gsde", [tuple(), ("gSDE=True",)])
|
408 |
| -@pytest.mark.skipif(not _has_gym, reason="No gym library found") |
409 | 420 | @pytest.mark.parametrize("exploration", ["random", "mode"])
|
410 | 421 | def test_redq_make(device, from_pixels, gsde, exploration):
|
411 | 422 | if not gsde and exploration != "random":
|
|
0 commit comments