Skip to content

Commit a8f1e4b

Browse files
committed
docs: COMMIT_LINT.md: update instructions for unit tests
Signed-off-by: Eduardo Silva <[email protected]>
1 parent fa4cc9d commit a8f1e4b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

COMMIT_LINT.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,46 @@ Expected one of: router:
5454
Commit prefix validation failed.
5555
```
5656

57+
## Running Unit Tests
58+
59+
The commit linter has comprehensive unit tests. To run them:
60+
61+
### Prerequisites
62+
63+
Install the test dependencies:
64+
65+
```bash
66+
pip install pytest gitpython
67+
```
68+
69+
### Running Tests
70+
71+
From the repository root directory, run:
72+
73+
```bash
74+
# Run all tests
75+
pytest .github/scripts/tests/test_commit_lint.py -v
76+
77+
# Run a specific test
78+
pytest .github/scripts/tests/test_commit_lint.py::test_valid_commit_single_prefix -v
79+
80+
# Run with more detailed output
81+
pytest .github/scripts/tests/test_commit_lint.py -v -s
82+
```
83+
84+
Alternatively, you can run from the scripts directory:
85+
86+
```bash
87+
cd .github/scripts
88+
pytest tests/test_commit_lint.py -v
89+
```
90+
91+
The test suite covers:
92+
- Prefix inference from file paths
93+
- Bad squash detection
94+
- Commit validation (success and error cases)
95+
- Edge cases and boundary conditions
96+
5797
## Testing Specific Commits
5898

5999
To test a specific commit, you can temporarily checkout that commit:

0 commit comments

Comments
 (0)