Phase 2a: SDK test hygiene (QA nits from PR #21)

phase-2026-03-09-2a-sdk-test-hygiene Phase

phase
Goal: Fix two test hygiene issues in pal-e-docs-sdk discovered during Phase 2 QA (PR #21 review).
Owner: Dev agent
Repo: forgejo_admin/pal-e-docs-sdk
Depends on: Phase 2 SDK PR #21 (must merge first — nits are in that code)

Problem

Two issues found during QA of PR #21:
  • Inline import json in tests/test_notes.py — 4 occurrences of import json inside test method bodies (lines 61, 87, 102, 113) instead of a top-level import. Every other test file in the repo (test_projects.py, test_sprints.py, test_links.py, test_repos.py, test_blocks.py) does the import at the top level correctly. test_notes.py is the only offender.
  • Integration test cleanup not in a fixture — PR #21 introduces the first write integration test (create_note_from_template). The cleanup delete_note() runs inline after assertions. If an assertion fails, the test note is orphaned in the live DB. This sets a bad precedent since all previous integration tests were read-only and didn't need cleanup. Need a fixture-based pattern in tests/integration/conftest.py for future write tests to reuse.

Fix

  • tests/test_notes.py — move import json to top-level imports, remove 4 inline imports
  • tests/integration/conftest.py — add a cleanup_slugs fixture (or similar) that collects slugs created during a test and deletes them in teardown via try/finally or yield
  • tests/integration/test_notes.py — refactor the create_note_from_template test to use the new cleanup fixture instead of inline delete_note()
  • plan-2026-03-09-template-rendering — parent plan
  • QA review: pal-e-docs-sdk issue #19, comment #2126