Skip to content

Commit 2043712

Browse files
authored
(fix): update pylint tutorial link and link text (#3748)
1 parent 9d7e0a5 commit 2043712

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

docs/TESTS.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ You should also install the following `pytest` plugins:
1010
We also recommend using the code linting program [pylint][pylint], as it is part of our automated feedback on the website and can be a very useful static code analysis tool.
1111
For ease-of-use, the [pytest-pylint][pytest-pylint] plugin for `pytest` will allow you to run `pylint` via `pytest` on the command line.
1212

13-
Pylint configuration can be a bit much, so this [tutorial from pycqa.org][tutorial from pycqa.org] can be helpful for getting started, as can this overview of [Code Quality: Tools and Best Practices][Code Quality: Tools and Best Practices] from Real Python.
14-
13+
Pylint configuration can be a bit much, so this [tutorial from pylint.readthedocs.io][tutorial from pylint.readthedocs.io] can be helpful for getting started, as can this overview of [Code Quality: Tools and Best Practices][Code Quality: Tools and Best Practices] from Real Python.
1514

1615
## Installing pytest
1716

@@ -25,7 +24,6 @@ Please adjust the install commands below accordingly.
2524
To install `pytest` in a virtual environment, ensure the environment **is activated** prior to executing commands.
2625
Otherwise, the `pytest` installation will be global.
2726

28-
2927
#### Windows
3028

3129
```powershell
@@ -41,7 +39,6 @@ Successfully installed pytest-7.2.2 ...
4139

4240
```
4341

44-
4542
To check if installation was successful:
4643

4744
```bash
@@ -85,7 +82,6 @@ More information on pytest marks can be found in the `pytest` documentation on [
8582

8683
_More information on customizing pytest configurations can be found in the pytest documentation on [configuration file formats][configuration file formats]_
8784

88-
8985
### Test Failures
9086

9187
When tests fail, `pytest` prints the text of each failed test, along with the expected and actual `return` values of each to the terminal.
@@ -110,13 +106,12 @@ FAILED exercise_test.py::ExerciseTest::name_of_failed_test
110106

111107
If you really want to be specific about what pytest returns on your screen, here are some handy command-line arguments that allows you to configure its behavior.
112108

113-
114109
#### Return All Details [`-v`]
115110

116111
Adding the `-v` (_verbose_) flag will return both environment information and a test summary in addition to test failures:
117112

118113
```bash
119-
$(my_venv) python3 -m pytest -o markers=task -v exercises/<exercise_name>/<test_file_test.py>
114+
$(my_venv) python3 -m pytest -o markers=task -v exercises/<exercise_name>/<test_file_test.py>
120115

121116
======================================== test session starts ===========================================
122117
platform darwin -- Python 3.9.0, pytest-6.2.5, -- /usr/local/envs/my_env/bin/python3
@@ -125,7 +120,7 @@ metadata: {'Python': '3.9.0', 'Platform': 'macOS-10.14.6-x86_64-i386-64bit', 'Pa
125120
rootdir: /Users/<user>/exercism/python, configfile: pytest.ini
126121
plugins: subtests-0.5.0, pylint-0.18.0
127122

128-
collected 5 items
123+
collected 5 items
129124

130125
exercises/exercise-name/exercise_file_test.py::ExerciseNameTest::test_one FAILED [ 20%]
131126
exercises/exercise-name/exercise_file_test.py::ExerciseNameTest::test_two FAILED
@@ -149,7 +144,7 @@ Using the `-x` flag will run the tests as normal, but stop the test run upon the
149144
This helps when you want to debug a single task or test failure at a time:
150145

151146
```bash
152-
$(my_venv) python3 -m pytest -o markers=task -x exercises/<exercise_name>/<test_file_test.py>
147+
$(my_venv) python3 -m pytest -o markers=task -x exercises/<exercise_name>/<test_file_test.py>
153148

154149
=================== FAILURES ====================
155150
_______________ example_test_foo ________________
@@ -166,7 +161,6 @@ FAILED example_test.py::ExampleTest::example_test_foo
166161
The `pytest-cache` plugin remembers which tests failed last time you ran `pytest`, so using the flag `--ff` will tell `pytest` to run previously failed tests **first**, then continue with the remainder of the tests.
167162
This might speed up your testing if you are making a lot of smaller fixes around one particular task or set of inputs.
168163

169-
170164
```bash
171165
$(my_venv) python3 -m pytest -o markers=task --ff <example_file_test.py>
172166
==================== 7 passed in 503s ====================
@@ -192,7 +186,6 @@ This will test your solution.
192186
When `pytest` encounters a failed test, the program will stop and tell you which test failed.
193187
When you make fixes and run the test again, `pytest` will first run the previous test that failed, then continue with the remaining tests.
194188

195-
196189
### Using PDB, the Python Debugger, with pytest
197190

198191
If you want to "debug like a pro", you can use the `--pdb` argument after the `pytest` command, and drop into the built-in [Python debugger][pdb], `PDB`.
@@ -206,13 +199,11 @@ When a test fails, dropping into `PDB` will allow you to step through your code
206199
More details on the `PDB` module can be found in the [Python documentation on PDB][pdb].
207200
Additionally, the [pytest docs on PDB][pytest-pdb] and [this guide from Real Python](https://realpython.com/python-debugging-pdb/) are extremely helpful.
208201

209-
210202
## Extending your IDE
211203

212204
If you'd like to extend your IDE with some tools that will help you with testing and improving your code, check the [tools](./tools) page.
213205
We explore multiple IDEs, editors and some useful extensions for linting and debugging there.
214206

215-
216207
## Additional information
217208

218209
### Adding python to your PATH
@@ -245,7 +236,6 @@ Then add a new line, as shown in the picture, replacing `{python_directory}` wit
245236

246237
![Add python to path](https://raw.githubusercontent.com/exercism/python/main/docs/img/Windows-AddPythonPath.png)
247238

248-
249239
#### MacOS/Linux
250240

251241
The below should work for most Linux and MacOS flavors with a `bash` shell.
@@ -264,13 +254,13 @@ export PATH=”$PATH:{python_directory}}”
264254
[pip]: https://pip.pypa.io/en/stable/getting-started/
265255
[psf-installer]: https://www.python.org/downloads/
266256
[pylint]: https://pylint.pycqa.org/en/latest/user_guide/
267-
[pytest-cache]:http://pythonhosted.org/pytest-cache/
257+
[pytest-cache]: http://pythonhosted.org/pytest-cache/
268258
[pytest-pdb]: https://docs.pytest.org/en/6.2.x/usage.html#dropping-to-pdb-python-debugger-on-failures
269-
[pytest-pylint]:https://github.com/carsongee/pytest-pylint
270-
[pytest-subtests]:https://github.com/pytest-dev/pytest-subtests
259+
[pytest-pylint]: https://github.com/carsongee/pytest-pylint
260+
[pytest-subtests]: https://github.com/pytest-dev/pytest-subtests
271261
[pytest.ini]: https://github.com/exercism/python/blob/main/pytest.ini
272262
[python command line]: https://docs.python.org/3/using/cmdline.html
273263
[python-m-pip]: https://snarky.ca/why-you-should-use-python-m-pip/
274264
[quick-and-dirty]: https://snarky.ca/a-quick-and-dirty-guide-on-how-to-install-packages-for-python/
275-
[tutorial from pycqa.org]: https://pylint.pycqa.org/en/v2.17.2/tutorial.html
265+
[tutorial from pylint.readthedocs.io]: https://pylint.readthedocs.io/en/v2.17.7/tutorial.html
276266
[working with custom markers]: https://docs.pytest.org/en/6.2.x/example/markers.html#working-with-custom-markers

0 commit comments

Comments
 (0)