Skip to content

Commit ba40d0b

Browse files
committed
Update TESTS.md
- Change placeholder brackets from `{}` to `<>` - Add a note explain placeholder value - Change pytest version number to reflect the latest one
1 parent c38e94b commit ba40d0b

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

docs/TESTS.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,40 @@ Otherwise, the `pytest` installation will be global.
2828

2929
```powershell
3030
PS C:\Users\foobar> py -m pip install pytest pytest-cache pytest-subtests pytest-pylint
31-
Successfully installed pytest-7.2.2 ...
31+
Successfully installed pytest-8.3.3 ...
3232
```
3333

3434
#### Linux / MacOS
3535

3636
```bash
3737
$ python3 -m pip install pytest pytest-cache pytest-subtests pytest-pylint
38-
Successfully installed pytest-7.2.2 ...
38+
Successfully installed pytest-8.3.3 ...
3939

4040
```
4141

4242
To check if installation was successful:
4343

4444
```bash
4545
$ python3 -m pytest --version
46-
pytest 7.2.2
46+
pytest 8.3.3
4747
```
4848

4949
## Running the tests
5050

51-
To run the tests, go to the folder where the exercise is stored using `cd` in your terminal (_replace `{exercise-folder-location}` below with your path_).
51+
To run the tests, go to the folder where the exercise is stored using `cd` in your terminal (_replace `<exercise-folder-location>` below with your path_).
5252

5353
```bash
54-
$ cd {exercise-folder-location}
54+
$ cd <exercise-folder-location>
5555
```
56+
**Note:** `<exercise-folder-location>` or most things inside angle brackets denote a placeholder value.
57+
A normal path should simply has its name without any brackets like: `myFolder` or `myFile.py`
5658

5759
The file you will want to run usually ends in `_test.py`.
5860
This file contains the tests for the exercise solution, and are the same tests that run on the website when a solution is uploaded.
59-
Next, run the following command in your terminal, replacing `{exercise_test.py}` with the location/name of the test file:
61+
Next, run the following command in your terminal, replacing `<exercise_test.py>` with the location/name of the test file:
6062

6163
```bash
62-
$ python3 -m pytest -o markers=task {exercise_test.py}
64+
$ python3 -m pytest -o markers=task <exercise_test.py>
6365
==================== 7 passed in 0.08s ====================
6466
```
6567

@@ -88,15 +90,15 @@ When tests fail, `pytest` prints the text of each failed test, along with the ex
8890
Below is an generic example of a failed test:
8991

9092
```bash
91-
$(my_venv) python3 -m pytest -o markers=task {exercise_test.py}
93+
$(my_venv) python3 -m pytest -o markers=task <exercise_test.py>
9294

9395
=================== FAILURES ====================
9496
______________ name_of_failed_test ______________
95-
# Test code inside of {exercise_test.py} that failed.
97+
# Test code inside of <exercise_test.py> that failed.
9698
...
9799
E TypeOfError: ReturnedValue != ExpectedValue
98100

99-
exercise_test.py:{line_of_failed_test}: TypeOfError
101+
exercise_test.py:<line_of_failed_test>: TypeOfError
100102
============ short test summary info ============
101103
FAILED exercise_test.py::ExerciseTest::name_of_failed_test
102104
========== 1 failed, 2 passed in 0.13s ==========
@@ -216,10 +218,10 @@ If you do not know where you have installed Python, run the following command in
216218

217219
```bash
218220
$ python3 -c "import os, sys; print(os.path.dirname(sys.executable))"
219-
{python_directory}
221+
<python_directory>
220222
```
221223

222-
The _returned_ directory is where your current active Python version is installed, in this section it is referred to as `{python_directory}`.
224+
The _returned_ directory is where your current active Python version is installed, in this section it is referred to as `<python_directory>`.
223225

224226
#### Windows
225227

@@ -232,25 +234,25 @@ Then find the `Path` variable in your _User variables_, select it, and click `Ed
232234

233235
![Selecting the path variable](https://raw.githubusercontent.com/exercism/python/main/docs/img/Windows-EnvironmentVariables.png)
234236

235-
Then add a new line, as shown in the picture, replacing `{python_directory}` with your Python installation's directory:
237+
Then add a new line, as shown in the picture, replacing `<python_directory>` with your Python installation's directory:
236238

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

239241
#### MacOS/Linux
240242

241243
The below should work for most Linux and MacOS flavors with a `bash` shell.
242244
Commands may vary by Linux distro, and whether a `fish` or `zsh` shell is used.
243-
Replace `{python_directory}` with the output of `python3 -c "import os, sys; print(os.path.dirname(sys.executable))"`
245+
Replace `<python_directory>` with the output of `python3 -c "import os, sys; print(os.path.dirname(sys.executable))"`
244246

245247
```bash
246-
export PATH=”$PATH:{python_directory}}
248+
export PATH=”$PATH:<python_directory>
247249
```
248250

249251
[Code Quality: Tools and Best Practices]: https://realpython.com/python-code-quality/
250252
[Getting Started Guide]: https://docs.pytest.org/en/latest/getting-started.html
251253
[configuration file formats]: https://docs.pytest.org/en/6.2.x/customize.html#configuration-file-formats
252254
[marking test functions with attributes]: https://docs.pytest.org/en/6.2.x/mark.html#raising-errors-on-unknown-marks
253-
[pdb]: https://docs.python.org/3.9/library/pdb.html
255+
[pdb]: https://docs.python.org/3.11/library/pdb.html
254256
[pip]: https://pip.pypa.io/en/stable/getting-started/
255257
[psf-installer]: https://www.python.org/downloads/
256258
[pylint]: https://pylint.pycqa.org/en/latest/user_guide/

0 commit comments

Comments
 (0)