fix up some slow tests that launch python

This commit is contained in:
George Hotz
2025-10-14 18:42:42 +08:00
parent d3bfcd3277
commit 8a34a4e2c7
4 changed files with 48 additions and 36 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python
import unittest, os, subprocess, sys
import unittest, os, subprocess
from tinygrad import Tensor
from tinygrad.device import Device, Compiler
from tinygrad.device import Device, Compiler, enumerate_devices_str
from tinygrad.helpers import diskcache_get, diskcache_put, getenv, Context, WIN, CI
class TestDevice(unittest.TestCase):
@@ -100,10 +100,7 @@ class TestCompiler(unittest.TestCase):
class TestRunAsModule(unittest.TestCase):
def test_module_runs(self):
p = subprocess.run([sys.executable, "-m", "tinygrad.device"],stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env={**os.environ, "DEBUG": "1"}, timeout=40,)
out = (p.stdout + p.stderr).decode()
self.assertEqual(p.returncode, 0, msg=out)
out = '\n'.join(enumerate_devices_str())
self.assertIn("CPU", out) # for sanity check
if __name__ == "__main__":