Skip to content

Update "TESTS.md" to Show That There Is a Version of "pytest" for Both Python and Python3 #506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 24, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions docs/TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ 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.

If you want to install the version of pytest that obeys Python 2.X syntax, then use `pip`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be better worded as: "If you want to install pytest for Python 2, then use pip:"?
Similar wording can be used for Python 3.


```bash
pip install pytest pytest-cache
```
If you instead want the vesrion of pytest that obeys Python 3.X syntax, then use `pip3`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you have a typo here: "vesrion" -> "version"


```bash
pip3 install pytest pytest-cache
```
**Note:** Whichever version of pytest you install first will be the default one used.

If you get a `command not found` response from your system, you can find a
tutorial on how to install `pip`
Expand All @@ -29,7 +37,7 @@ an example here), place yourself in the directory where that exercise has been
fetched and run:

```bash
py.test bob_test.py
pytest bob_test.py
```

**Note:** To run the tests you need to pass the name of the testsuite file to
Expand All @@ -56,22 +64,22 @@ The above will run all the tests, whether they fail or not. If you'd rather stop
the process and exit on the first failure, run:

```bash
py.test -x bob_test.py
pytest -x bob_test.py
```

### Failed Tests First

`pytest-cache` remembers which tests failed, and can run those tests first.

```bash
py.test --ff bob_test.py
pytest --ff bob_test.py
```

### Running All Tests for All Exercises

```bash
cd exercism/python/
py.test
pytest
```

## Recommended Workflow
Expand All @@ -80,7 +88,7 @@ We recommend you run this command while working on exercises.

```bash
cd exercism/python/bob
py.test -x --ff bob_test.py
pytest -x --ff bob_test.py
```

## PDB
Expand All @@ -93,7 +101,7 @@ You may also be interested in watching [Clayton Parker's "So you think you can
pdb?" PyCon 2015 talk](https://www.youtube.com/watch?v=P0pIW5tJrRM)

```bash
py.test --pdb bob_test.py
pytest --pdb bob_test.py
```

## PEP8
Expand All @@ -107,10 +115,16 @@ compliance to the style guide, install
pip install pytest-pep8
```

or, for Python 3.X syntax compliance...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this new part.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this might be better worded as "or, if you're using Python 3:"?


```bash
pip install pytest-pep8
```

and add the pep8 flag to your command

```bash
py.test --pep8 bob_test.py
pytest --pep8 bob_test.py
```

Read the [pytest documentation](http://pytest.org/latest/contents.html#toc) and
Expand Down