Skip to content

Commit

Permalink
Add section on unit testing to CONTRIBUTING (pytorch#5813)
Browse files Browse the repository at this point in the history
  • Loading branch information
zou3519 authored and ezyang committed Mar 15, 2018
1 parent abd6f82 commit 42ba8c1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,28 @@ For example:

You do not need to repeatedly install after modifying python files.

## Unit testing

PyTorch's testing is located under `test/`. Run the entire test suite with

```
python test/run_test.py
```

or run individual test files, like `python test/test_nn.py`, for individual test suites.

### Better local unit tests with pytest
We don't officially support `pytest`, but it works well with our `unittest` tests and offers
a number of useful features for local developing. Install it via `pip install pytest`.

If you want to just run tests that contain a specific substring, you can use the `-k` flag:

```
pytest test/test_nn.py -k Loss -v
```

The above is an example of testing a change to Loss functions: this command runs tests such as
`TestNN.test_BCELoss` and `TestNN.test_MSELoss` and can be useful to save keystrokes.

## Writing documentation

Expand Down

0 comments on commit 42ba8c1

Please sign in to comment.