Running Tests - NatLabRockies/alfalfa GitHub Wiki
Running tests locally
There are three stages of tests: unit tests, docker-based simulation tests, and integration tests. To run the tests, first run the following commands, then jump to the section of interest below.
- Install Docker Desktop for your platform
- Install Poetry:
pip install poetry - Install dependencies:
poetry install
Unit Tests
- Run unit tests:
poetry run pytest
Docker-based Simulation Tests
-
Run docker dev stack locally (in detached mode)
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build -d -
Call Modelica tests
docker exec alfalfa_worker bash -c "cd /alfalfa && pytest -m docker tests/jobs/modelica" -
Call OpenStudio tests:
docker exec alfalfa_worker bash -c "cd /alfalfa && pytest -m docker tests/jobs/openstudio" -
Clean up stack:
docker-compose down
Integration Tests
- Run stack locally in detached mode:
docker-compose up --build -d - Run integration tests:
poetry run pytest -m "integration" - Clean up stack:
docker-compose down