Skip to content

Commit 977e7db

Browse files
committed
WORKFLOW: Improved Documentation On Tests
* Recommended that users install pytest and pytest-cache * Gave examples of how to use pytest * Documented how to run tests without pytest
1 parent f897c53 commit 977e7db

1 file changed

Lines changed: 43 additions & 6 deletions

File tree

docs/WORKFLOW.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,59 @@
1-
## Running Tests for an Exercise
1+
## Tests
22

3-
Execute tests for an exercise with:
3+
We recommend you install [pytest](http://pytest.org/latest/) and [pytest-cache](http://pythonhosted.org/pytest-cache/). Pytest is a testing tool that will give you more flexibility over running your unit tests.
4+
5+
If you choose not to install pytest, you can still run tests individually:
46

57
```bash
68
$ cd exercism/python/bob
79
$ python bob_test.py
810
```
911

10-
## Running Tests for All Exercises
12+
### Installation
13+
14+
```bash
15+
$ pip install pytest pytest-cache
16+
```
1117

12-
Before running all the tests ensure you have pytest installed:
18+
## Pytest Examples
19+
20+
####Run All Tests
1321

1422
```bash
15-
$ pip install pytest
23+
$ cd exercism/python/bob
24+
$ py.test bob_test.py
1625
```
17-
After pytest is installed all tests can be executed with:
26+
27+
####Stop After First Failure
28+
29+
```bash
30+
$ cd exercism/python/bob
31+
$ py.test -x bob_test.py
32+
```
33+
34+
####Failed Tests First
35+
36+
Pytest-cache remembers which tests failed, and can run those tests first.
37+
38+
```bash
39+
$ cd exercism/python/bob
40+
$ py.test --ff bob_test.py
41+
```
42+
43+
### Recommended
44+
45+
We recommend you run this command while working on exercises.
46+
47+
```bash
48+
$ cd exercism/python/bob
49+
$ py.test -x --ff bob_test.py
50+
```
51+
52+
### Running All Tests for All Exercises
1853

1954
```bash
2055
$ cd exercism/python/
2156
$ py.test
2257
```
58+
59+
Read the [pytest documentation](http://pytest.org/latest/contents.html#toc) and [pytest-cache](http://pythonhosted.org/pytest-cache/) documentation to learn more.

0 commit comments

Comments
 (0)