Development and tests
Run locally, run tests in containers and the rules for contributions – including wiki maintenance.
Running locally
Without containers, with Python 3.13, Poppler and Tesseract (with the language packs deu, eng, nld) on the system:
cd app
pip install -r requirements-dev.txt -r requirements-optional.txt
CLIPR_DATA_DIR=./.data CLIPR_COOKIE_SECURE=0 CLIPR_SANDBOX=0 \
CLIPR_ADMIN_USER=dev CLIPR_ADMIN_PASSWORD=dev-passwort-123 \
CLIPR_WEB_DIR=../web uvicorn clipr.main:app --reload
CLIPR_COOKIE_SECURE=0 allows cookies without HTTPS (local only). CLIPR_SANDBOX=0 speeds up imports; in operation the sandbox stays on.
For a stack like in operation (Caddy, TLS) use a separate project with its own .env, its own ports and its own subnet – never the running installation:
docker compose -p clipr-dev --env-file ../dev.env -f docker-compose.yml up -d --build
Tests
Tests run in containers with all system packages. Results are the same on every machine, and the running installation stays untouched.
App (app/tests, pytest):
docker build -t clipr-test -f - . <<'EOF2'
FROM python:3.13-slim-trixie
RUN apt-get update && apt-get install -y --no-install-recommends poppler-utils tesseract-ocr tesseract-ocr-osd \
tesseract-ocr-deu tesseract-ocr-eng tesseract-ocr-nld tesseract-ocr-fra tesseract-ocr-ita tesseract-ocr-spa \
tesseract-ocr-pol && rm -rf /var/lib/apt/lists/*
COPY app/requirements.txt app/requirements-dev.txt app/requirements-optional.txt /tmp/
RUN pip install -q -r /tmp/requirements-dev.txt -r /tmp/requirements-optional.txt
WORKDIR /src
EOF2
docker run --rm -v "$PWD":/src:ro -w /src/app -e CLIPR_WEB_DIR=/src/web -e PYTHONDONTWRITEBYTECODE=1 \
clipr-test python -m pytest -q -p no:cacheprovider
Wiki (wiki/tests):
docker build -t clipr-wiki-test -f - wiki <<'EOF2'
FROM python:3.13-slim-trixie
COPY requirements.txt requirements-dev.txt /tmp/
RUN pip install --root-user-action=ignore -q -r /tmp/requirements-dev.txt
WORKDIR /src
EOF2
docker run --rm -v "$PWD":/src:ro -w /src/wiki -e PYTHONDONTWRITEBYTECODE=1 \
clipr-wiki-test python -m pytest -q -p no:cacheprovider
Shell: scripts/cliprctl must pass shellcheck without findings:
docker run --rm -v "$PWD":/mnt:ro koalaman/shellcheck:stable scripts/cliprctl
What the tests cover
| Area | Examples |
|---|---|
| Multi-user | Registration, vault, groups, shares, separation of accounts, migration of legacy data |
| Import | Parsers (rail, Eventim, Ticketmaster, passes), classification (terms, invoice, cancellation), codes, stacks, UIC 918.3 |
| Security | CSRF, origin, security headers, throttling, sandbox and Landlock, SSRF, two-factor, SSO tickets |
| IMAP against a local test server – including proof that no writing commands are sent | |
| Wiki | Sanitising (XSS), paths, sign-in, editor API |
| Docs | see below |
Test documents in app/tests/fixtures are recreated and contain no real personal data. app/tests/pdfgen.py generates further PDFs within the tests.
Rules for contributions
- Docs in the same commit. Every change to features, settings, interface or operations brings the matching wiki pages – in German and English. Every Clipr version thus ships its own matching wiki.
- Tests green – app, wiki, shellcheck.
- Stay generic. No personal data, addresses or credentials in the repository; examples use
example.org. Features for one provider must not break others. - Security first. No inline scripts or styles (CSP), validate input on the server, analyse foreign files only in the sandbox. New risks go into
SECURITY.md. - Think of translation. New texts in
web/assets/i18n/en.json, composed texts viat()– see Internationalisation. - Service worker: raise
SHELL_CACHEinweb/sw.jswhen app files change.
The docs tests
wiki/tests/test_docs.py checks the shipped docs on every test run:
- Every page exists in German and English, with title and content.
- Internal links and anchors point to existing pages and headings, images exist, and sanitising removes nothing.
- Every configuration variable (app, wiki, compose,
.env.example) is in Configuration. - Every
cliprctlcommand is in the command reference. - Every HTTP endpoint of the app is in the API reference.
If one of these tests fails, documentation is missing – the test is not wrong.
Editing the wiki
- In the editor: with the overlay
docker-compose.wiki-dev.yml, changes from the browser land directly indocs/wikiand can be checked with git – see Running the wiki. - As files:
docs/wiki/<chapter>/<page>.<de|en>.md, chapter page_index.<de|en>.md. Front matter:title,order(smaller numbers first), optionalsummary(one sentence below the title and on the chapter card) andhidden. - Images live in the chapter's folder. File names: lower-case letters, digits,
-and_, extensionpng,jpg,webporgif. Screenshots per language with-de/-enin the name; only with test data, never with real accounts. - Layout: notice boxes with
<div class="callout callout-tip|note|warning|danger">, phone screenshots in<figure class="shot-phone">, several side by side in<div class="shots">, entry tiles with<div class="tiles"><a class="tile">. Diagrams as Mermaid code blocks.