Add in-process unit tests and 100% coverage config#6
Conversation
|
saw this one too — it's marked draft so i'll wait for you to take it out of draft. heads up that main just moved (card feature + your copilot source merged), so it'll need a rebase. the in-process test approach looks right. |
The existing subprocess tests drive the CLI end to end but never import ditto, so they do not measure ditto.py's own lines. Add tests/test_ditto_unit.py that imports the module and exercises every branch: redaction, log-shape parsing for Codex, Claude, and Copilot, session labelling, chunking, and all install targets. Reaches 100% statement and branch coverage of ditto.py. Run with: python -m coverage run -m unittest discover -s tests && python -m coverage report Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep .coverage data files and htmlcov/ reports out of version control. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cfc870e to
94b8575
Compare
|
rebased and added test cases for the new code so things are at 100% coverage; ready for review |
|
Really appreciate this. 75 tests and full-branch coverage is exactly what I want sitting under the rewrite that's coming. One thing before I merge: it's green on your CI but red on Windows for me. ditto.install_destination("claude", "/repo", "/home").endswith("/.claude/skills/you/SKILL.md")On Windows that returns dest = ditto.install_destination("claude", "/repo", "/home").replace(os.sep, "/")
self.assertTrue(dest.endswith("/.claude/skills/you/SKILL.md"))Ditto ships on Windows (Hebrew paths and all), so I want the suite green there too before it goes in. Fix that and I'll merge. Heads up: there's a bigger If you want to go back and forth on it, come hang in the Discord: https://discord.gg/VNnMq2U5r |
|
I pulled this back into draft. I won't be near a Windows machine until next week and I can wait for the in flight to land and get the coverage needed |
|
Perfect, no rush at all. The rewrite should land before you're back at a Windows machine, and your suite is going to make merging it a lot safer. Ping me when you take it out of draft. |
What
Adds direct unit tests plus coverage config:
tests/test_ditto_unit.py: importsdittoand exercises every branch:redaction, log-shape parsing for Codex, Claude, and Copilot, verbatim
dedupe, session labelling, chunking, stats, the profile card (terminal and
HTML rendering, browser open, fallbacks), all install targets, and
main()dispatch including
--card..coveragerc: branch coverage on thedittomodule..gitignore: ignore.coverageandhtmlcov/.Reaches 100% statement and branch coverage of
ditto.py(377 statements, 152branches, 0 missed), 75 tests.
Why
The existing tests drive the CLI end to end through
subprocess, so they neverimport
dittoand do not measure its own lines. These do, and they lock thebehavior of the card renderer and the dedupe path against regressions.
Run
The plain CI command also passes: