Graph tests require Memgraph to be running. Memgraph is only needed for testing, not as a production dependency.
-
Start Memgraph using Docker:
docker compose -f docker-compose.test.yml up -d
-
Run the tests:
poetry run pytest tests/test_graph.py -v
✅ SAFETY: Tests only delete nodes labeled with
:___DIALEXITY_TEST___- Production data is safe - tests can run alongside real data
- All test nodes are automatically labeled by the test fixture
- Only labeled test data is cleaned up before/after each test
-
Access Memgraph Lab (visual interface): Open http://localhost:3000 in your browser to visualize the graph database.
-
Stop Memgraph:
docker compose -f docker-compose.test.yml down
Tests will automatically skip with a helpful message:
SKIPPED - Memgraph is not available. Run: docker-compose -f docker-compose.test.yml up -d
For CI environments, you can add Memgraph as a service:
GitHub Actions example:
services:
memgraph:
image: memgraph/memgraph:latest
ports:
- 7687:7687conftest.py- Shared fixtures including Memgraph connectiontest_graph.py- Graph structure tests (Perspective, components, relationships)
- Each test runs in a clean database (cleared before/after)
- The
dbfixture automatically handles connection and cleanup - Memgraph runs in-memory mode for fast testing