Skip to content

Commit 326a6cf

Browse files
committed
docs(contributing): diff from the merge base when proving a test fails without its fix
The fail-without-fix recipe in test-coverage.rst diffed against origin/main with two dots. That diff also holds the commits origin/main has and the branch lacks, as reverse deltas, so reverse-applying it undid main's work in the tree. Diff origin/main...HEAD (three dots) instead, and say why in one sentence.
1 parent a37edf1 commit 326a6cf

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎docs/source/contributing/conventions/test-coverage.rst‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@ Raising Coverage
114114
**Every change raises coverage, and each new test is shown to fail without its fix.**
115115
A test that also passes on the unfixed tree cannot tell the fix from its absence, so it
116116
pins nothing. Before opening the pull request, take the fix out, run the new test, put
117-
the fix back, and say in the pull request that you did:
117+
the fix back, and say in the pull request that you did. Diff the committed fix from the
118+
merge base, with three dots: a two-dot ``git diff origin/main`` also carries the commits
119+
``origin/main`` has and the branch lacks, as reverse deltas, and reverse-applying it
120+
undoes that work in the tree.
118121

119122
.. code-block:: shell
120123
121-
git diff origin/main -- pcapkit/ > /tmp/fix.diff
124+
git diff origin/main...HEAD -- pcapkit/ > /tmp/fix.diff
122125
git apply -R /tmp/fix.diff
123126
python -m pytest tests/<path>/test_<name>_unit.py -q # must fail
124127
git apply /tmp/fix.diff

0 commit comments

Comments
 (0)