Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Bepo CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
env:
TRANSFORMERS_OFFLINE: "1"
HF_HUB_OFFLINE: "1"
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt

- name: Run tests
run: python -m pytest tests/ -v
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,16 @@ Returns API version information and a list of available endpoints.
## Running Tests

```bash
pip install pytest httpx
pip install -r requirements-dev.txt
python -m pytest tests/ -v
```

Tests use a temporary in-memory database and never attempt to download the CLIP model.
Tests disable CLIP/model downloads and run against temporary SQLite DB/filesystem paths (not your local `memories.db` or `images/`).

## CI

GitHub Actions runs `python -m pytest tests/ -v` on every pull request and on pushes to `main`.
CI sets `TRANSFORMERS_OFFLINE=1` and `HF_HUB_OFFLINE=1` defensively so tests never rely on model downloads.

## Database Schema

Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytest
httpx
4 changes: 3 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def isolated_db(tmp_path, monkeypatch):
Point DB_PATH / IMAGES_DIR at temp paths and ensure CLIP is disabled
so tests never attempt a model download.
"""
# Suppress CLIP – must be patched before init_db/lifespan runs
# Force offline mode and suppress CLIP before init_db/lifespan runs
monkeypatch.setenv("TRANSFORMERS_OFFLINE", "1")
monkeypatch.setenv("HF_HUB_OFFLINE", "1")
monkeypatch.setattr(app_module, "USE_CLIP", False)
monkeypatch.setattr(app_module, "model", None)
monkeypatch.setattr(app_module, "processor", None)
Expand Down
Loading