Problem
KnickKnackLabs/notes#127 adds the first explicit Python note-component parser surface (notes parse + lib/note_components.py). The PR kept BATS coverage for CLI behavior, but the library semantics are now substantial enough that they should eventually have a proper Python test suite.
During review, Or also caught that Python assertions embedded as single-line python3 -c commands in BATS are not acceptable. #127 fixed that locally by making the BATS assertions readable, and KnickKnackLabs/codebase#47 tracks a future lint for that smell. This issue tracks the more structural follow-up: test Python library semantics in Python.
Proposal
Add a small Python test suite for Python library code in notes, probably using pytest.
Suggested shape:
- Add
pyproject.toml for Python test/dev dependencies.
- Add pytest as a dev/test dependency.
- Add a mise task such as
test:python or integrate Python tests into the existing test task.
- Add tests under
test/python/ or tests/ for:
parse_frontmatter_text;
parse_mapping_text;
parse_note_text / read_note_components;
- malformed frontmatter remains body text;
- comments/future conventions remain body text;
- block-list parsing behavior already used by
list/show/search.
BATS should remain the CLI/integration layer:
notes parse <file> works through mise;
NOTES_CALLER_PWD path resolution works;
- missing note exits nonzero;
- JSON is emitted.
Why not in #127
#127 is already the parser foundation PR and was intentionally narrowed several times: no notes read, no backmatter/banknotes, direct uv task, readable BATS assertions. Adding pytest in the same PR would widen scope. This is better as a follow-up once #127 lands.
Acceptance criteria
- Python parser/library behavior is covered by a Python test suite.
- Existing BATS parse tests are reduced to CLI integration checks where appropriate.
- The main
mise run test path runs both BATS and Python tests, or the README clearly documents both test commands.
- No Python assertion one-liners remain in BATS for parser/library semantics.
Related
- Parser PR:
KnickKnackLabs/notes#127
- Original read/query proposal:
KnickKnackLabs/notes#126
- Future BATS lint:
KnickKnackLabs/codebase#47
- Fold guidance:
fold/notes/bats-tool-testing.md
Problem
KnickKnackLabs/notes#127adds the first explicit Python note-component parser surface (notes parse+lib/note_components.py). The PR kept BATS coverage for CLI behavior, but the library semantics are now substantial enough that they should eventually have a proper Python test suite.During review, Or also caught that Python assertions embedded as single-line
python3 -ccommands in BATS are not acceptable. #127 fixed that locally by making the BATS assertions readable, andKnickKnackLabs/codebase#47tracks a future lint for that smell. This issue tracks the more structural follow-up: test Python library semantics in Python.Proposal
Add a small Python test suite for Python library code in
notes, probably using pytest.Suggested shape:
pyproject.tomlfor Python test/dev dependencies.test:pythonor integrate Python tests into the existingtesttask.test/python/ortests/for:parse_frontmatter_text;parse_mapping_text;parse_note_text/read_note_components;list/show/search.BATS should remain the CLI/integration layer:
notes parse <file>works through mise;NOTES_CALLER_PWDpath resolution works;Why not in #127
#127 is already the parser foundation PR and was intentionally narrowed several times: no
notes read, no backmatter/banknotes, direct uv task, readable BATS assertions. Adding pytest in the same PR would widen scope. This is better as a follow-up once #127 lands.Acceptance criteria
mise run testpath runs both BATS and Python tests, or the README clearly documents both test commands.Related
KnickKnackLabs/notes#127KnickKnackLabs/notes#126KnickKnackLabs/codebase#47fold/notes/bats-tool-testing.md