1- # Test for git-extras
2- The git-extras has its own testcases now, and the more is on the way! So let's introduce it.
1+ # Testing
32
4- We choose python to help us to reach to other shore cause ** python is life saver** .
3+ Originally, the tests were written in pytest. However, tests are in the process of being converted to Bats so coverage can be calculated.
4+
5+ ## Bats Testing
6+
7+ We require a somewhat recent version of Bats. Version v1.8.1 is tested in CI. Once it is installed, the tests can be executed like so:
8+
9+ ``` sh
10+ bats ./tests
11+ ```
12+
13+ We highly recommend adding tests for new features and fixes.
14+
15+ ### Code Coverage
16+
17+ Coverage can be calculated with [ bashcov] ( https://github.com/infertux/bashcov ) like so:
18+
19+ ``` sh
20+ bashcov -- bats ./tests
21+ ```
22+
23+ By default, the report will be generated in ` ./coverage/index.html ` .
24+
25+ ## Python Testing
526
627The test part depends on:
728
@@ -12,7 +33,8 @@ The test part depends on:
1233
1334So the versions are higher than above is recommended.
1435
15- # How to run the tests
36+ ### How to run the tests
37+
16381 . Install ` poetry `
17392 . Install the dependencies via ` poetry install `
18403 . Run ` poetry run pytest `
@@ -27,7 +49,8 @@ It is done or go without `poetry`,
2749
2850The second way maybe blocked the some missing dependencies at someday, so the first one is recommended.
2951
30- # What and how to create a unit test
52+ ### What and how to create a unit test
53+
3154One command has a unit test, because one ` git-* ` command is just do one thing, so we can eat a piece of ` git-* ` command in one time.
3255
3356For example,
@@ -39,7 +62,8 @@ For example,
3962 * ` named_temp_repo ` is just same as ` temp_repo ` except the custom directory renaming.
40634 . Loop the third step until the 100% coverage of the function of the ` git-alias `
4164
42- # References
65+ ### References
66+
4367* [ poetry] ( https://github.com/python-poetry/poetry )
4468* [ pytest] ( https://github.com/pytest-dev/pytest/ )
4569* [ git python] ( https://github.com/gitpython-developers/GitPython )
0 commit comments