MCPcopy Create free account
hub / github.com/ml-explore/mlx / createTests

Method createTests

python/tests/mlx_tests.py:26–55  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

24 super().__init__(*args, **kwargs)
25
26 def createTests(self, *args, **kwargs):
27 super().createTests(*args, **kwargs)
28
29 # Asume CUDA backend in this case
30 device = os.getenv("DEVICE", None)
31 if device is not None:
32 device = getattr(mx, device)
33 else:
34 device = mx.default_device()
35
36 if not (device == mx.gpu and not mx.metal.is_available()):
37 return
38
39 from cuda_skip import cuda_skip
40
41 filtered_suite = unittest.TestSuite()
42
43 def filter_and_add(t):
44 if isinstance(t, unittest.TestSuite):
45 for sub_t in t:
46 filter_and_add(sub_t)
47 else:
48 t_id = ".".join(t.id().split(".")[-2:])
49 if t_id in cuda_skip:
50 print(f"Skipping {t_id}")
51 else:
52 filtered_suite.addTest(t)
53
54 filter_and_add(self.test)
55 self.test = filtered_suite
56
57 def runTests(self):
58 super().runTests()

Callers

nothing calls this directly

Calls 1

is_availableMethod · 0.45

Tested by

no test coverage detected