Skip to content

Commit

Permalink
chore: pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sash-a committed Mar 25, 2024
1 parent 54a1ff8 commit 325b411
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
14 changes: 14 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 InstaDeep Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pytest


Expand Down
37 changes: 31 additions & 6 deletions test/integration_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 InstaDeep Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import importlib

import pytest
Expand All @@ -15,12 +29,19 @@
"q_learning.rec_iql",
]

discrete_envs = ["gigastep", "lbf", "matrax", "rware", "smax"]
discrete_envs = [
# "gigastep",
"lbf",
# "matrax",
"rware",
"smax",
]
cnn_envs = ["cleaner", "connector"]
continuous_envs = ["mabrax"]


def _run_system(system_name: str, cfg: DictConfig) -> float:
"""Runs a system."""
OmegaConf.set_struct(cfg, False)
cfg.logger.use_neptune = False # we never want to log these tests to neptune

Expand All @@ -32,7 +53,7 @@ def _run_system(system_name: str, cfg: DictConfig) -> float:


def _get_fast_config(cfg: DictConfig, fast_config: dict) -> DictConfig:
# merging fast_config into cfg
"""Makes the configs use a minimum number of timesteps and evaluations."""
dconf: dict = OmegaConf.to_container(cfg, resolve=True)
dconf["system"] |= fast_config["system"]
dconf["arch"] |= fast_config["arch"]
Expand All @@ -42,7 +63,8 @@ def _get_fast_config(cfg: DictConfig, fast_config: dict) -> DictConfig:


@pytest.mark.parametrize("system_path", system_paths)
def test_mava_system(fast_config: dict, system_path: str):
def test_mava_system(fast_config: dict, system_path: str) -> None:
"""Does a simple test of all mava systems, by checking that everything pipes through."""
_, system_name = system_path.split(".")

with initialize(version_base=None, config_path="../mava/configs/"):
Expand All @@ -53,7 +75,8 @@ def test_mava_system(fast_config: dict, system_path: str):


@pytest.mark.parametrize("env_name", discrete_envs)
def test_discrete_env(fast_config: dict, env_name: str):
def test_discrete_env(fast_config: dict, env_name: str) -> None:
"""Tests all discrete environments on ff_ippo."""
system_path = "ppo.ff_ippo"
system_name = "ff_ippo"

Expand All @@ -65,7 +88,8 @@ def test_discrete_env(fast_config: dict, env_name: str):


@pytest.mark.parametrize("env_name", cnn_envs)
def test_discrete_cnn_env(fast_config: dict, env_name: str):
def test_discrete_cnn_env(fast_config: dict, env_name: str) -> None:
"""Tests all cnn environments on ff_ippo."""
system_path = "ppo.ff_ippo"
system_name = "ff_ippo"

Expand All @@ -78,7 +102,8 @@ def test_discrete_cnn_env(fast_config: dict, env_name: str):


@pytest.mark.parametrize("env_name", continuous_envs)
def test_continuous_env(fast_config: dict, env_name: str):
def test_continuous_env(fast_config: dict, env_name: str) -> None:
"""Tests all continuous environments on ff_isac."""
system_path = "sac.ff_isac"
system_name = "ff_isac"

Expand Down

0 comments on commit 325b411

Please sign in to comment.