Phase 2a: SDK test hygiene (QA nits from PR #21)
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-sdkDepends 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 jsonintests/test_notes.py— 4 occurrences ofimport jsoninside 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.pyis the only offender. - Integration test cleanup not in a fixture — PR #21 introduces the first write integration test (
create_note_from_template). The cleanupdelete_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 intests/integration/conftest.pyfor future write tests to reuse.
Fix
tests/test_notes.py— moveimport jsonto top-level imports, remove 4 inline importstests/integration/conftest.py— add acleanup_slugsfixture (or similar) that collects slugs created during a test and deletes them in teardown viatry/finallyoryieldtests/integration/test_notes.py— refactor thecreate_note_from_templatetest to use the new cleanup fixture instead of inlinedelete_note()
Related
plan-2026-03-09-template-rendering— parent plan- QA review: pal-e-docs-sdk issue #19, comment #2126