Skip to content

Commit 825bda1

Browse files
rlundeen2jsong468
andauthored
Update 6_unit_tests.md
Co-authored-by: jsong468 <[email protected]>
1 parent 5ec10c1 commit 825bda1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doc/contributing/6_unit_tests.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Testing is an art to get right! But here are some best practices in terms of uni
66

77
- Make a test that checks one thing and one thing only.
88
- Use `fixtures` generally, and specifically, if you're using something across classes, use `unit.mocks` or `integration.mocks`.
9-
- Memory isolation: Use the `patch_central_database` fixture for test database isolation and reset. Because this is a singelton, never set memory in an object directly, as this will impact other tests (e.g. never do something like `orchestrator._memory.get_prompt_pieces = MagicMock()`). Patching central memory with a scope is okay (e.g. `with patcho.object(orchestrator._memory.get_prompt_request_pieces)`).
9+
- Memory isolation: Use the `patch_central_database` fixture for test database isolation and reset. Because this is a singleton, never set memory in an object directly, as this will impact other tests (e.g. never do something like `orchestrator._memory.get_prompt_pieces = MagicMock()`). Patching central memory with a scope is okay (e.g. `with patch.object(orchestrator._memory.get_prompt_request_pieces):`).
1010
- Code coverage and functionality should be checked with unit tests. Notebooks and integration tests should not be relied on for coverage.
1111
- `MagicMock` and `AsyncMock`: these are the preferred way to mock calls.
1212
- `with patch` is acceptable to patch external calls.

0 commit comments

Comments
 (0)