Skip to content

Commit

Permalink
Move all tests to gym/tests/... (#2425)
Browse files Browse the repository at this point in the history
* Moved all (?) tests to gym/tests

* flake8

* Move all the tests into gym/gym/tests, this might fix all the import errors... hopefully

* Move unittests back to envs

* Fix unittest again

* black

* Fix to one test due to new paths
  • Loading branch information
RedTachyon authored Sep 28, 2021
1 parent 52b7e5e commit 3331efe
Show file tree
Hide file tree
Showing 56 changed files with 19 additions and 20 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import pickle
import unittest

import pytest

from gym import envs
from gym.envs.tests.spec_list import skip_mujoco, SKIP_MUJOCO_WARNING_MESSAGE
from gym.tests.envs.spec_list import skip_mujoco, SKIP_MUJOCO_WARNING_MESSAGE


ENVIRONMENT_IDS = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest

from gym import envs
from gym.envs.tests.spec_list import skip_mujoco, SKIP_MUJOCO_WARNING_MESSAGE
from gym.tests.envs.spec_list import skip_mujoco, SKIP_MUJOCO_WARNING_MESSAGE


ENVIRONMENT_IDS = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest

from gym import envs
from gym.envs.tests.spec_list import skip_mujoco, SKIP_MUJOCO_WARNING_MESSAGE
from gym.tests.envs.spec_list import skip_mujoco, SKIP_MUJOCO_WARNING_MESSAGE


@pytest.mark.skipif(skip_mujoco, reason=SKIP_MUJOCO_WARNING_MESSAGE)
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pytest

from gym.envs.tests.spec_list import spec_list
from gym.tests.envs.spec_list import spec_list


@pytest.mark.parametrize("spec", spec_list)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np

from gym import envs
from gym.envs.tests.spec_list import spec_list
from gym.tests.envs.spec_list import spec_list
from gym.spaces import Box
from gym.utils.env_checker import check_env

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import pytest
from gym import spaces, logger
from gym.envs.tests.spec_list import spec_list
from gym.tests.envs.spec_list import spec_list

DATA_DIR = os.path.dirname(__file__)
ROLLOUT_STEPS = 100
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
import numpy as np
from gym import envs
from gym.envs.tests.spec_list import skip_mujoco, SKIP_MUJOCO_WARNING_MESSAGE
from gym.tests.envs.spec_list import skip_mujoco, SKIP_MUJOCO_WARNING_MESSAGE


def verify_environments_match(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, arg1, arg2, arg3):

gym.register(
id="test.ArgumentEnv-v0",
entry_point="gym.envs.tests.test_registration:ArgumentEnv",
entry_point="gym.tests.envs.test_registration:ArgumentEnv",
kwargs={
"arg1": "arg1",
"arg2": "arg2",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from multiprocessing import TimeoutError
from gym.spaces import Box, Tuple
from gym.error import AlreadyPendingCallError, NoAsyncCallError, ClosedEnvironmentError
from gym.vector.tests.utils import (
from gym.tests.vector.utils import (
CustomSpace,
make_env,
make_slow_env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from gym.spaces import Tuple, Dict
from gym.vector.utils.spaces import _BaseGymSpaces
from gym.vector.tests.utils import spaces
from gym.tests.vector.utils import spaces

from gym.vector.utils.numpy_utils import concatenate, create_empty_array

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from multiprocessing import Array, Process
from collections import OrderedDict

from gym.spaces import Box, Tuple, Dict
from gym.spaces import Tuple, Dict
from gym.error import CustomSpaceError
from gym.vector.utils.spaces import _BaseGymSpaces
from gym.vector.tests.utils import spaces, custom_spaces
from gym.tests.vector.utils import spaces, custom_spaces

from gym.vector.utils.shared_memory import (
create_shared_memory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import numpy as np

from gym.spaces import Box, MultiDiscrete, Tuple, Dict
from gym.vector.tests.utils import spaces, custom_spaces, CustomSpace
from gym.tests.vector.utils import spaces, custom_spaces, CustomSpace

from gym.vector.utils.spaces import _BaseGymSpaces, batch_space
from gym.vector.utils.spaces import batch_space

expected_batch_spaces_4 = [
Box(low=-1.0, high=1.0, shape=(4,), dtype=np.float64),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np

from gym.spaces import Box, Tuple
from gym.vector.tests.utils import CustomSpace, make_env, make_custom_space_env
from gym.tests.vector.utils import CustomSpace, make_env, make_custom_space_env

from gym.vector.sync_vector_env import SyncVectorEnv

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np

from gym.spaces import Tuple
from gym.vector.tests.utils import CustomSpace, make_env
from gym.tests.vector.utils import CustomSpace, make_env

from gym.vector.async_vector_env import AsyncVectorEnv
from gym.vector.sync_vector_env import SyncVectorEnv
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions scripts/generate_json.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from gym import envs, spaces, logger
from gym import envs, logger
import json
import os
import sys
import argparse

from gym.envs.tests.spec_list import should_skip_env_spec_for_tests
from gym.envs.tests.test_envs_semantics import generate_rollout_hash, hash_object
from gym.tests.envs.spec_list import should_skip_env_spec_for_tests
from gym.tests import generate_rollout_hash

DATA_DIR = os.path.join(os.path.dirname(__file__), os.pardir, "gym", "envs", "tests")
ROLLOUT_STEPS = 100
Expand Down
Empty file.
Empty file removed tests/gym/wrappers/__init__.py
Empty file.

0 comments on commit 3331efe

Please sign in to comment.