diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 033a1ea9d..000000000 --- a/.coveragerc +++ /dev/null @@ -1,6 +0,0 @@ -[run] -omit = - */common/vendor/* - */tests/* - common/vendor/* - tests/* diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index 3e21af64d..dab274acb 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -54,3 +54,8 @@ If you're interested in tackling a bug, please say so and I can assign it to you # Documentation If you make changes, please remember to update the user documentation to reflect the new behavior. + + +## Package Testing + +Check the implementation details of the [tests](docs/testing.md). diff --git a/docs/testing.md b/docs/testing.md new file mode 100644 index 000000000..11088e1c3 --- /dev/null +++ b/docs/testing.md @@ -0,0 +1,32 @@ +# Package Testing + +We try to cover the most crucial functionality with unit tests using +[UnitTesting](https://github.com/randy3k/UnitTesting). To run the tests +locally, you should install UnitTesting via Package Control. + +## Run the test specs locally + +First you need to [clone](https://github.com/divmain/GitSavvy#less-simple) GitSavvy repo from source. +Open the directory `GitSavvy` and simply run the command `UnitTesting: Test Current Project` + +## Some details about DeferrableTestCase + +[DeferrableTestCase][1] is used to write the test cases. They are executed by +the [DeferringTextTestRunner][2] and the runner expects not only regular test +functions, but also generators. If the test function is a generator, it does +the following + +- if the yielded object is a callable, the runner will evaluate the + [callable][3] and check its returned value. If the result is `True`, the + runner continues the generator, if not, the runner will wait until the + condition is met. + +- If the yielded object is an integer, say `x`, then it will [continue][4] the + generator after `x` ms. + +- Otherwise, the `yield` statement will always wait for 10 ms. + +[1]: https://github.com/randy3k/UnitTesting/blob/dc810ee334bb031710b859478faaf50293880995/unittesting/core/st3/runner.py#L49 +[2]: https://github.com/randy3k/UnitTesting/blob/dc810ee334bb031710b859478faaf50293880995/unittesting/core/st3/runner.py#L7 +[3]: https://github.com/randy3k/UnitTesting/blob/dc810ee334bb031710b859478faaf50293880995/unittesting/core/st3/runner.py#L49 +[4]: https://github.com/randy3k/UnitTesting/blob/dc810ee334bb031710b859478faaf50293880995/unittesting/core/st3/runner.py#L57