Skip to content

Commit 08ebb4a

Browse files
author
sidey79
committed
docs(agents): document running the test suite in the devcontainer
There is deliberately no virtualenv in the repository root, which invites building an ad hoc environment instead - that pulls its own package versions, misses the companion services and produces numbers that are not the project's. The devcontainer already defines both, so AGENTS.md now says so and gives the plain Compose commands for use outside VS Code, including the explicit pip3 install that the postCreateCommand would otherwise do. Also records why a branch switch can fail with a permission error on .devcontainer/fhem-data/: the FHEM image owns those files as 6061 unless FHEM_UID and FHEM_GID point at the host user.
1 parent 822d4e3 commit 08ebb4a

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎AGENTS.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,33 @@ This file provides guidance to agents when working with code in this repository.
1515
oder um eine längere Laufzeit zu analysieren:
1616
`python3 main.py --timeout 30`
1717

18+
## Testausführung im Devcontainer
19+
- **Tests laufen im Devcontainer des Projekts, nicht in einer selbst angelegten Umgebung.** Im
20+
Repository-Wurzelverzeichnis existiert bewusst kein Virtualenv; die Abhängigkeiten und die
21+
Begleitdienste (Mosquitto, FHEM) sind in `.devcontainer/` definiert. Eine ad-hoc erzeugte
22+
Umgebung läuft daran vorbei, kann abweichende Paketversionen ziehen und liefert Messergebnisse,
23+
die nicht die des Projekts sind.
24+
- In VS Code genügt "Reopen in Container"; der `postCreateCommand` aus
25+
`.devcontainer/devcontainer.json` installiert `requirements-dev.txt` und `requirements.txt`.
26+
- Ohne VS Code lässt sich derselbe Service direkt über Compose nutzen:
27+
```bash
28+
cd .devcontainer
29+
docker compose up -d devcontainer
30+
docker compose exec -T devcontainer bash -lc \
31+
"cd /workspaces/PySignalduino && pip3 install --quiet --user -r requirements-dev.txt -r requirements.txt"
32+
docker compose exec -T devcontainer bash -lc \
33+
"cd /workspaces/PySignalduino && timeout 120 python3 -m pytest -q"
34+
```
35+
Hinweis: Über Compose gestartet greifen die `features` aus `devcontainer.json` (Node, uv,
36+
AsciiDoc) nicht, und der `postCreateCommand` läuft nicht automatisch — deshalb der explizite
37+
`pip3 install`. Für die Testsuite reicht das aus.
38+
- Der FHEM-Dienst desselben Compose-Setups schreibt nach `.devcontainer/fhem-data/`. Das Image legt
39+
diese Dateien standardmäßig unter UID/GID 6061 an, wodurch Git sie auf dem Host nicht mehr
40+
ersetzen kann — ein Branch-Wechsel scheitert dann mit `unable to unlink old '<datei>':
41+
Permission denied`. Abhilfe schafft, im `fhem`-Service die Variablen `FHEM_UID` und `FHEM_GID`
42+
auf den eigenen Host-Benutzer zu setzen (`id -u` / `id -g`); der Dateibesitz sollte dagegen
43+
nicht per `chown` umgebogen werden, da FHEM im Container sonst nicht mehr schreiben kann.
44+
1845
## Test Timeout Configuration
1946
- Für pytest wurde ein globaler Timeout von 30 Sekunden in der `pyproject.toml` konfiguriert:
2047
```toml

0 commit comments

Comments
 (0)