Skip to content

Commit e2ceead

Browse files
committed
Added running tests file to shared docs.
1 parent 267162b commit e2ceead

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

exercises/shared/tests.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Tests
2+
3+
You can run the incluyded tests by typing `pytest <exercisename>_test.py` on the command line from within the exercise's directory.
4+
5+
You can also tell Python to run the pytest module on the command line from either within the exercise directory or with a path to the exercise directory.
6+
`python -m pytest <exercisename>_test.py` from within the exercise directory.
7+
8+
`python -m pytest /fully/qualified/path/to/<exercisename>/` OR `python -m pytest realtive/path/to/<exercisename>` from a non-exercise directory.
9+
10+
Many IDE's and code editors also have built-in spport for using PyTest to run tests.
11+
12+
[Visual Studio Code](https://code.visualstudio.com/docs/python/testing)
13+
[PyCharm Professional & Community Editions](https://www.jetbrains.com/help/pycharm/pytest.html#create-pytest-test)
14+
[Atom](https://atom.io/packages/atom-python-test)
15+
[Spyder](https://www.spyder-ide.org/blog/introducing-unittest-plugin/)
16+
[Sublime](https://github.com/kaste/PyTest)
17+
[vim-test](https://github.com/vim-test/vim-test)
18+
19+
See the [Python tests page](https://exercism.io/tracks/python/tests) for more information.
20+
21+
### Common `pytest` options
22+
23+
- `-v` : enable verbose output.
24+
- `-x` : stop running tests on first failure.
25+
- `--ff` : run failures from previous test before running other test cases.
26+
27+
For other options, see `python -m pytest -h`. PyTest documentation can be found [here](https://docs.pytest.org/en/6.2.x/getting-started.html).

0 commit comments

Comments
 (0)