# How to test properly?

**URL:** <https://dev-discuss.pytorch.org/t/how-to-test-properly/2492>\
**Category:** testing\
**Created:** [September 24, 2024, 6:25pm UTC](https://dev-discuss.pytorch.org/t/how-to-test-properly/2492 "2024-09-24T18:25:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NiklasZ](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@NiklasZ](https://dev-discuss.pytorch.org/u/NiklasZ)\
**Post date:** [September 24, 2024, 6:25pm UTC](https://dev-discuss.pytorch.org/t/how-to-test-properly/2492/1 "2024-09-24T18:25:41Z")

</div>

Hi,  
I’m pretty new to making code contributions on this project and am a bit at a loss as to how to test my PRs properly. I’ve read the [contributer guide](https://github.com/pytorch/pytorch/blob/main/CONTRIBUTING.md#unit-testing) and run `python test/run_test.py`, but am having the following issues:

1. A number of tests fail locally, even when I checkout the `strict/viable` branch and apply no changes.
2. Running all of the tests takes hours (I killed the test script after the 3h mark).

Given that, if I make some changes, how do I know which (if any) tests will break as a result? Is there some nice way to get a quick `test diff`?

---

<div class="post-metadata">

**Author:** ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)\
**Post date:** [September 25, 2024, 9:40pm UTC](https://dev-discuss.pytorch.org/t/how-to-test-properly/2492/2 "2024-09-25T21:40:36Z")

</div>

Hey!

I’m afraid there is no easy solution for this.  
Usually, I would recommend to run the test file corresponding to the feature you’re working in. `python test_autograd.py` for example.  
The best way to run the full test suite remains to push a PR and see what fails on github (you can add the keep-going label there to get all errors) and then run these files locally to make sure you fixed them.
