You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update "TESTS.md" to show that there is a version of "pytest" for both Python2 and Python3 (#506)
* Update TESTS.md
Provides information on the different types of "pytest" available, as well as switched "py.test" to "pytest", as recommended here (pytest-dev/pytest#1629 (comment)).
* Fixed a typo.
* Small edit.
* Update TESTS.md
Cleaned it up, addressed what user "N-Parsons" commented on, fixed some errors, and added new information.
* Small Change to "PDB" Section.
**Note:** Whichever version of `pytest` you install last will be the default one used whenever `pytest` is executed, regardless of whether you have installed both versions.
23
+
24
+
If you want to check what the default version of `pytest` being used is, run the following:
25
+
26
+
```bash
27
+
pytest --version
28
+
```
29
+
30
+
If you have either version of `pytest` installed and you want to specifically run one of the versions, you can run that version by using `python` with the `-m` flag.
31
+
32
+
For example, you could run the Python 3 version of pytest like so:
33
+
34
+
```bash
35
+
$ python3 -m pytest --version
36
+
This is pytest version 3.2.3, imported from /usr/local/lib/python3.5/dist-packages/pytest.py
37
+
```
38
+
15
39
If you choose not to install `pytest`, you can still run tests individually and
16
40
skip the rest of this tutorial:
17
41
@@ -29,7 +53,7 @@ an example here), place yourself in the directory where that exercise has been
29
53
fetched and run:
30
54
31
55
```bash
32
-
py.test bob_test.py
56
+
pytest bob_test.py
33
57
```
34
58
35
59
**Note:** To run the tests you need to pass the name of the testsuite file to
@@ -56,22 +80,22 @@ The above will run all the tests, whether they fail or not. If you'd rather stop
56
80
the process and exit on the first failure, run:
57
81
58
82
```bash
59
-
py.test -x bob_test.py
83
+
pytest -x bob_test.py
60
84
```
61
85
62
86
### Failed Tests First
63
87
64
88
`pytest-cache` remembers which tests failed, and can run those tests first.
65
89
66
90
```bash
67
-
py.test --ff bob_test.py
91
+
pytest --ff bob_test.py
68
92
```
69
93
70
94
### Running All Tests for All Exercises
71
95
72
96
```bash
73
97
cd exercism/python/
74
-
py.test
98
+
pytest
75
99
```
76
100
77
101
## Recommended Workflow
@@ -80,7 +104,7 @@ We recommend you run this command while working on exercises.
80
104
81
105
```bash
82
106
cd exercism/python/bob
83
-
py.test -x --ff bob_test.py
107
+
pytest -x --ff bob_test.py
84
108
```
85
109
86
110
## PDB
@@ -89,28 +113,28 @@ Will drop you into the python debugger when a test fails. To learn how to use
0 commit comments