You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+19-6Lines changed: 19 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,14 @@ See the [README.md](README.md) file for a project overview.
15
15
### Build and Test Commands
16
16
17
17
- Install: `just install` or `pip install -e ".[dev]"`
18
-
- Run all tests (with coverage): `just test` - Runs both unit and integration tests with unified coverage
19
-
- Run unit tests only: `just test-unit` - Fast, no coverage
20
-
- Run integration tests only: `just test-int` - Fast, no coverage
21
-
- Generate HTML coverage: `just coverage` - Opens in browser
18
+
- Run all tests (SQLite + Postgres): `just test`
19
+
- Run all tests against SQLite: `just test-sqlite`
20
+
- Run all tests against Postgres: `just test-postgres` (uses testcontainers)
21
+
- Run unit tests (SQLite): `just test-unit-sqlite`
22
+
- Run unit tests (Postgres): `just test-unit-postgres`
23
+
- Run integration tests (SQLite): `just test-int-sqlite`
24
+
- Run integration tests (Postgres): `just test-int-postgres`
25
+
- Generate HTML coverage: `just coverage`
22
26
- Single test: `pytest tests/path/to/test_file.py::test_function_name`
23
27
- Run benchmarks: `pytest test-int/test_sync_performance_benchmark.py -v -m "benchmark and not slow"`
24
28
- Lint: `just lint` or `ruff check . --fix`
@@ -30,6 +34,8 @@ See the [README.md](README.md) file for a project overview.
30
34
31
35
**Note:** Project requires Python 3.12+ (uses type parameter syntax and `type` aliases introduced in 3.12)
32
36
37
+
**Postgres Testing:** Uses [testcontainers](https://testcontainers-python.readthedocs.io/) which automatically spins up a Postgres instance in Docker. No manual database setup required - just have Docker running.
38
+
33
39
### Test Structure
34
40
35
41
-`tests/` - Unit tests for individual components (mocked, fast)
@@ -76,8 +82,10 @@ See the [README.md](README.md) file for a project overview.
76
82
- SQLite is used for indexing and full text search, files are source of truth
77
83
- Testing uses pytest with asyncio support (strict mode)
78
84
- Unit tests (`tests/`) use mocks when necessary; integration tests (`test-int/`) use real implementations
79
-
- Test database uses in-memory SQLite
80
-
- Each test runs in a standalone environment with in-memory SQLite and tmp_file directory
85
+
- By default, tests run against SQLite (fast, no Docker needed)
86
+
- Set `BASIC_MEMORY_TEST_POSTGRES=1` to run against Postgres (uses testcontainers - Docker required)
87
+
- Each test runs in a standalone environment with isolated database and tmp_path directory
88
+
- CI runs SQLite and Postgres tests in parallel for faster feedback
81
89
- Performance benchmarks are in `test-int/test_sync_performance_benchmark.py`
82
90
- Use pytest markers: `@pytest.mark.benchmark` for benchmarks, `@pytest.mark.slow` for slow tests
83
91
@@ -229,6 +237,11 @@ of using AI just for code generation, we've developed a true collaborative workf
229
237
This approach has allowed us to tackle more complex challenges and build a more robust system than either humans or AI
230
238
could achieve independently.
231
239
240
+
**Problem-Solving Guidance:**
241
+
- If a solution isn't working after reasonable effort, suggest alternative approaches
242
+
- Don't persist with a problematic library or pattern when better alternatives exist
243
+
- Example: When py-pglite caused cascading test failures, switching to testcontainers-postgres was the right call
244
+
232
245
## GitHub Integration
233
246
234
247
Basic Memory has taken AI-Human collaboration to the next level by integrating Claude directly into the development workflow through GitHub:
Copy file name to clipboardExpand all lines: README.md
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -437,38 +437,39 @@ See the [Documentation](https://memory.basicmachines.co/) for more info, includi
437
437
438
438
### Running Tests
439
439
440
-
Basic Memory supports dual database backends (SQLite and Postgres). Tests are parametrized to run against both backends automatically.
440
+
Basic Memory supports dual database backends (SQLite and Postgres). By default, tests run against SQLite. Set `BASIC_MEMORY_TEST_POSTGRES=1`to run against Postgres (uses testcontainers - Docker required).
441
441
442
442
**Quick Start:**
443
443
```bash
444
-
# Run SQLite tests (default, no Docker needed)
444
+
# Run all tests against SQLite (default, fast)
445
445
just test-sqlite
446
446
447
-
# Run Postgres tests (requires Docker)
447
+
# Run all tests against Postgres (uses testcontainers)
448
448
just test-postgres
449
+
450
+
# Run both SQLite and Postgres tests
451
+
just test
449
452
```
450
453
451
454
**Available Test Commands:**
452
455
453
-
-`just test-sqlite` - Run tests against SQLite only (fastest, no Docker needed)
454
-
-`just test-postgres` - Run tests against Postgres only (requires Docker)
456
+
-`just test` - Run all tests against both SQLite and Postgres
457
+
-`just test-sqlite` - Run all tests against SQLite (fast, no Docker needed)
458
+
-`just test-postgres` - Run all tests against Postgres (uses testcontainers)
459
+
-`just test-unit-sqlite` - Run unit tests against SQLite
460
+
-`just test-unit-postgres` - Run unit tests against Postgres
461
+
-`just test-int-sqlite` - Run integration tests against SQLite
462
+
-`just test-int-postgres` - Run integration tests against Postgres
455
463
-`just test-windows` - Run Windows-specific tests (auto-skips on other platforms)
456
464
-`just test-benchmark` - Run performance benchmark tests
457
-
-`just test-all` - Run all tests including Windows, Postgres, and benchmarks
458
-
459
-
**Postgres Testing Requirements:**
460
465
461
-
To run Postgres tests, you need to start the test database:
462
-
```bash
463
-
docker-compose -f docker-compose-postgres.yml up -d
464
-
```
466
+
**Postgres Testing:**
465
467
466
-
Tests will connect to `localhost:5433/basic_memory_test`.
468
+
Postgres tests use [testcontainers](https://testcontainers-python.readthedocs.io/) which automatically spins up a Postgres instance in Docker. No manual database setup required - just have Docker running.
467
469
468
470
**Test Markers:**
469
471
470
472
Tests use pytest markers for selective execution:
471
-
-`postgres` - Tests that run against Postgres backend
0 commit comments