remove conda. add requirements.txt. add tests

This commit is contained in:
publicmatt
2024-03-14 13:47:37 -07:00
parent 355e83843f
commit 44250fc618
9 changed files with 324 additions and 12 deletions

2
test/.env.test Normal file
View File

@@ -0,0 +1,2 @@
TRAIN_PATH=${HOME}/Dev/ml/data/mnist_train.csv
INPUT_FEATURES=40

20
test/conftest.py Normal file
View File

@@ -0,0 +1,20 @@
# conftest.py
import pytest
import os
from dotenv import load_dotenv
from pathlib import Path
@pytest.fixture(autouse=True)
def load_env():
# Set up your environment variables here
env = Path(__file__).parent / ".env.test"
if not load_dotenv(env):
raise RuntimeError(".env not loaded")
# os.environ['MY_ENV_VAR'] = 'some_value'
# You can add more setup code here if needed
yield
# Optional: Cleanup code after test (if needed)
# e.g., unset environment variables if they should not persist after test

17
test/test_pipeline.py Normal file
View File

@@ -0,0 +1,17 @@
from src.model.linear import DNN
from src.data.dataset import MnistDataset
import os
def test_size_of_dataset():
examples = 500
os.environ["TRAINING_EXAMPLES"] = str(examples)
channels = 1
width, height = 224, 224
dataset = MnistDataset(os.getenv("TRAIN_PATH"))
# label = dataset[0][1].item()
image = dataset[0][0].shape
assert channels == image[0]
assert width == image[1]
assert height == image[2]
assert len(dataset) == examples