Testing
AIDRIN includes a suite of unit tests that run without a web interface, Celery broker, or Redis instance. They cover the core metrics library, file readers, and data quality functions.
Running the Unit Tests
Prerequisites
Activate the conda environment and ensure pytest and pytest-cov are installed:
conda activate aidrin-env
pip install pytest pytest-cov
Running All Unit Tests
From the project root:
PYTHONPATH=. pytest tests/unit/ -v
PYTHONPATH=. is required so Python can locate the aidrin and web packages.
Running a Specific Test File
PYTHONPATH=. pytest tests/unit/test_data_quality.py -v
Checking Code Coverage
PYTHONPATH=. pytest tests/unit/ --cov=aidrin --cov-report=term-missing
Test Structure
Tests live in tests/unit/ and are grouped by functional area:
File |
What is tested |
|---|---|
|
Completeness, duplicity, outliers |
|
Representation rate, statistical rate, class imbalance |
|
Single/multiple-attribute MM risk scores, k-anonymity, l-diversity, t-closeness, entropy risk |
|
HIPAA identifier detection (SSN, email, phone, IP, URL, medical IDs) |
|
JSON and NPZ file readers |
|
HDF5 file reader |
|
dtype handling across narrow numeric types and pandas StringDtype |
Integration Tests
Integration tests (requiring a running Flask app) live in tests/integration/.
See Web Application Installation for instructions on starting the full application stack before running them:
PYTHONPATH=. pytest tests/integration/ -v