Files
second-brain/knowledge/methods/testing.md
T
kiskaadee a1152d4075 docs(brain): add document metadata frontmatter
Add YAML frontmatter to all 54 retained markdown documents.
Frontmatter schema is type-specific — no universal status field.

Type contracts applied:
- knowledge: type + status (draft|stable) + topics
- project:   type + status (planned|active|paused|completed)
- plan:      type + status + project context
- guide:     type + project context (no lifecycle status)
- journal:   type + date (no status — journals are historical by definition)
- practice:  type + status (completed|active) + topics
- inbox:     type + created date

54 documents tagged across:
  knowledge/concepts/     (3)
  knowledge/technologies/ (7, including python/ subdirectory with 4)
  knowledge/methods/      (6)
  projects/homelab/       (1 overview + 6 plans + 6 guides)
  projects/magnetflix/    (1)
  projects/nekoweb/       (1)
  records/journal/        (7)
  practice/LeetCode/      (14)
  inbox/                  (1)
2026-09-05 21:49:17 -05:00

800 B

type, status, topics
type status topics
knowledge draft
testing
pytest

Testing Notes

Unit Testing vs. Integration Testing

  • Unit Testing: Tests individual components (e.g. functions, helper methods) in isolation. External dependencies (like databases or APIs) are mocked.
  • Integration Testing: Tests how different parts of the system work together (e.g. hitting an endpoint to ensure it writes to a test database and returns the correct response).

pytest best practices

  • Use fixtures (@pytest.fixture) for setup and teardown logic (e.g., creating and rolling back database sessions).
  • Keep tests fast by using in-memory databases (sqlite) or a separate Postgres test database that gets cleaned/re-seeded before each test.
  • Use pytest-cov to measure and monitor code coverage.