Skip to content

Commit

Permalink
Update test/dynamics/common.py
Browse files Browse the repository at this point in the history
Co-authored-by: Kento Ueda <[email protected]>
  • Loading branch information
DanPuzzuoli and to24toro authored Oct 6, 2023
1 parent 159a22b commit db07e1b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/dynamics/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ def test_array_backends(test_class, backends=None):
# reference to module that called this function
module = inspect.getmodule(inspect.stack()[1][0])

libs = ["numpy", "jax", "array_numpy", "array_jax"]
base_classes = [NumpyTestBase, JaxTestBase, ArrayNumpyTestBase, ArrayJaxTestBase]
for lib, base_class in zip(libs, base_classes):
if lib in backends:
classes = inspect.getmembers(inspect.getmodule(inspect.currentframe()), inspect.isclass)
base_classes = [cls[1] for cls in classes if hasattr(cls[1], "lib")]

for base_class in base_classes:
lib = base_class.lib()
class_name = f"{test_class.__name__}_{lib}"
setattr(module, class_name, type(class_name, (test_class, base_class), {}))

Expand Down

0 comments on commit db07e1b

Please sign in to comment.