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: doc/contributing/6_unit_tests.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Testing is an art to get right! But here are some best practices in terms of uni
6
6
7
7
- Make a test that checks one thing and one thing only.
8
8
- 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):`).
10
10
- Code coverage and functionality should be checked with unit tests. Notebooks and integration tests should not be relied on for coverage.
11
11
-`MagicMock` and `AsyncMock`: these are the preferred way to mock calls.
12
12
-`with patch` is acceptable to patch external calls.
0 commit comments