quick start (requires uv):
uv sync
./run-tests.ps1
docker run -d --name sbpostgres -e POSTGRES_PASSWORD=password1234 -p 5432:5432 postgres:11
$env:SB_PG_DB="host=localhost user=postgres password=password1234"
./run-slow-tests.ps1
./run-e2e-tests.ps1
uv run python sweetiebot.pyenvironment variables (see config.py):
| Variable | Required | Default | Description |
|---|---|---|---|
SB_PG_DB |
yes | (none) | libpq connection string for pg database |
SB_JID |
no | bot_user@jabberserver |
Jabber account |
SB_PASSWORD |
no | password1234 |
Jabber password |
SB_CHATROOM |
no | test_room@conference.jabberserver |
MUC room to join |
SB_NICKNAME |
no | Sweetiebot |
Nickname to use in the room |
SB_HOSTNAME |
no | (none) | Server to connect to, if distinct from SB_JID |
SB_PORT |
no | 5222 |
Port to connect to (when SB_HOSTNAME is set) |
SB_DEBUG |
no | (off) | Any non-empty value turns on debug logging |
SB_APPINSIGHTS_KEY |
no | (none) | Azure Monitor / App Insights instrumentation |
compose.test.yaml runs sweetiebot against a test jabber server and postgres database:
docker compose -f compose.test.yaml up --build -d
docker compose -f compose.test.yaml logs --follow sweetiebot
docker compose -f compose.test.yaml exec sbpostgres psql -U postgres -d sweetiebot
docker compose -f compose.test.yaml down -vLog in as normal_user@jabberserver / password1234 on localhost:5222 and join test_room@conference.jabberserver to talk to the bot.
Redis is dead in production, but lives on in the tests, since the FakeRedis class is a handy in-memory storage layer for unit tests to depend on.
- eg unit tests in
tests/Pings.pydepends onPingStorageRedis(FakeRedis()) - then
slow_tests/PingStorageTests.pytries to prove thatPingStorageRedisbehaves the same asPingStoragePg, so that the unit tests are also valid in the real code.