Skip to content

Adding tests #3

Description

@xyleth

Any preferences on test layout, fixture style, or dev-dep file naming before I start?

Any edge cases you're already aware of that need attention, or things you specifically want included / excluded/

This is the proposed scope I have:

Proposed scope (one PR):

  • New tests/ directory with pytest-based unit + light integration tests
  • New requirements-dev.txt containing pytest (Pillow already a runtime dep, used for image fixtures)
  • Coverage targets: MetadataWriter.write_metadata argv construction across the backup/append/skip matrix, MetadataWriter.read_existing_metadata JSON parsing, OllamaWorker._build_prompt, the LLM-response parser, and the RAW-vs-Pillow dispatch in _encode_image. Plus 1–2 end-to-end OllamaWorker runs with requests.post mocked.
  • No changes to photoscribe.py. All tests work by mocking at the existing seams (subprocess.run, requests.post).
  • No Qt UI tests, no CI config — keeping this PR small and pure-add.

One thing worth flagging: the LLM-response parser and the Ollama HTTP call are both inline inside OllamaWorker.run(). Mocking works fine for now, but if you'd be open to it later, extracting them into small helper methods (e.g. _parse_response(text), _call_ollama(payload)) would make the test surface cleaner and let us cover edge cases (multi-fence responses, retries) more directly. Happy to follow up with that as a separate PR if useful — it's not in scope for this one.

That sound good?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions