From 5cbaa233882b187c05bb004422a6b653db6f2c0b Mon Sep 17 00:00:00 2001 From: Erik Frey Date: Fri, 19 Jan 2024 11:14:06 -0800 Subject: [PATCH] Remove TEST_FILES from MJX test_util.py. PiperOrigin-RevId: 599886327 Change-Id: I4d166e09db22fffc959dbe34fa3469bd4a1b9f84 --- mjx/mujoco/mjx/_src/device_test.py | 6 ++--- mjx/mujoco/mjx/_src/support_test.py | 2 +- mjx/mujoco/mjx/_src/test_util.py | 9 +------ mjx/mujoco/mjx/_src/test_util_test.py | 38 --------------------------- 4 files changed, 5 insertions(+), 50 deletions(-) delete mode 100644 mjx/mujoco/mjx/_src/test_util_test.py diff --git a/mjx/mujoco/mjx/_src/device_test.py b/mjx/mujoco/mjx/_src/device_test.py index b4b9a0cd..71137c5d 100644 --- a/mjx/mujoco/mjx/_src/device_test.py +++ b/mjx/mujoco/mjx/_src/device_test.py @@ -59,7 +59,7 @@ def _assert_eq(testcase, a, b, attr=None, name=None): class DeviceTest(parameterized.TestCase): - @parameterized.parameters(test_util.TEST_FILES) + @parameterized.parameters('constraints.xml', 'pendula.xml') def testdevice_put(self, fname): """Test putting MjData and MjModel on device.""" m = test_util.load_test_file(fname) @@ -71,7 +71,7 @@ class DeviceTest(parameterized.TestCase): _assert_eq(self, mjx.device_put(d), d) _assert_eq(self, mjx.device_put(m), m) - @parameterized.parameters(test_util.TEST_FILES) + @parameterized.parameters('constraints.xml', 'pendula.xml') def testdevice_get(self, fname): """Test getting MjData from a device.""" m = test_util.load_test_file(fname) @@ -81,7 +81,7 @@ class DeviceTest(parameterized.TestCase): device.device_get_into(d, dx) _assert_eq(self, dx, d) - @parameterized.parameters(set(test_util.TEST_FILES) - {'convex.xml'}) + @parameterized.parameters('constraints.xml', 'pendula.xml') def testdevice_get_batched(self, fname): """Test getting MjData from a device.""" m = test_util.load_test_file(fname) diff --git a/mjx/mujoco/mjx/_src/support_test.py b/mjx/mujoco/mjx/_src/support_test.py index fb3a5389..f6a79488 100644 --- a/mjx/mujoco/mjx/_src/support_test.py +++ b/mjx/mujoco/mjx/_src/support_test.py @@ -27,7 +27,7 @@ import numpy as np class SupportTest(parameterized.TestCase): - @parameterized.parameters(set(test_util.TEST_FILES) - {'convex.xml'}) + @parameterized.parameters('constraints.xml', 'pendula.xml') def test_jac(self, fname): np.random.seed(0) diff --git a/mjx/mujoco/mjx/_src/test_util.py b/mjx/mujoco/mjx/_src/test_util.py index d350c11a..b360fb63 100644 --- a/mjx/mujoco/mjx/_src/test_util.py +++ b/mjx/mujoco/mjx/_src/test_util.py @@ -15,20 +15,13 @@ """Utilities for testing.""" import sys -from typing import Dict, List, Tuple +from typing import Dict, Tuple from xml.etree import ElementTree as ET from etils import epath import mujoco import numpy as np -TEST_FILES: List[str] = [ - 'constraints.xml', - 'convex.xml', - 'pendula.xml', - 'ray.xml', -] - _ACTUATOR_TYPES = ['motor', 'velocity', 'position', 'general', 'intvelocity'] _DYN_TYPES = ['none', 'integrator', 'filter', 'filterexact'] _DYN_PRMS = ['0.189', '2.1'] diff --git a/mjx/mujoco/mjx/_src/test_util_test.py b/mjx/mujoco/mjx/_src/test_util_test.py deleted file mode 100644 index e8d32dab..00000000 --- a/mjx/mujoco/mjx/_src/test_util_test.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2023 DeepMind Technologies Limited -# -# 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. -# ============================================================================== -"""Tests for the test_util.""" - -from absl.testing import absltest -from etils import epath -from mujoco.mjx._src import test_util - - -class TestUtilTest(absltest.TestCase): - - def test_files_in_test_data_match(self): - directory = epath.resource_path('mujoco.mjx') / 'test_data' - files = set([f.name for f in directory.glob('*.xml')]) - self.assertSetEqual( - files, - set(test_util.TEST_FILES), - msg=( - '`_test_util.TEST_FILES` must match the files in the ' - 'test_data/*.xml directory' - ), - ) - - -if __name__ == '__main__': - absltest.main()