diff --git a/tests-unit/execution_test/test_cache_provider.py b/tests-unit/execution_test/test_cache_provider.py index f5a6e2d03..bc321838d 100644 --- a/tests-unit/execution_test/test_cache_provider.py +++ b/tests-unit/execution_test/test_cache_provider.py @@ -1,8 +1,15 @@ """Tests for external cache provider API.""" +import importlib.util import pytest from typing import Optional + +def _torch_available() -> bool: + """Check if PyTorch is available.""" + return importlib.util.find_spec("torch") is not None + + from comfy_execution.cache_provider import ( CacheProvider, CacheContext, @@ -347,12 +354,3 @@ class MockCacheProvider(CacheProvider): def on_store(self, context: CacheContext, value: CacheValue) -> None: self.stores.append((context, value)) - - -def _torch_available() -> bool: - """Check if PyTorch is available.""" - try: - import torch - return True - except ImportError: - return False