From 1c26ce5164c312975ba1690c6275c335e83e7fc7 Mon Sep 17 00:00:00 2001 From: Vijay Janapa Reddi Date: Tue, 30 Sep 2025 16:08:21 -0400 Subject: [PATCH] Fix DataLoader integration tests to work before export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added fallback import logic: - Try importing from tinytorch package first - Fall back to dev modules if not exported yet - Works both before and after 'tito export 08_dataloader' All 3 integration tests pass: ✅ Training workflow integration ✅ Shuffle consistency across epochs ✅ Memory efficiency verification --- tests/integration/test_dataloader_integration.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_dataloader_integration.py b/tests/integration/test_dataloader_integration.py index b2d39e64..ff3c2a5e 100644 --- a/tests/integration/test_dataloader_integration.py +++ b/tests/integration/test_dataloader_integration.py @@ -12,8 +12,16 @@ import os # Add project root to path sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) -from tinytorch import Tensor -from tinytorch.data.loader import Dataset, TensorDataset, DataLoader +# Try to import from package, fall back to dev module if not exported yet +try: + from tinytorch import Tensor + from tinytorch.data.loader import Dataset, TensorDataset, DataLoader +except (ImportError, ModuleNotFoundError): + # Module not exported yet, use dev version + sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'modules', 'source', '08_dataloader')) + from dataloader_dev import Dataset, TensorDataset, DataLoader + sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'modules', 'source', '01_tensor')) + from tensor_dev import Tensor def test_training_workflow_integration():