Commit bc069d5
authored
Suppress PytestCollectionWarning for non-test classes (pytorch#18192)
Fixes pytorch#18175
Added `__test__ = False` to non-test classes that pytest was incorrectly
trying to collect as test classes, causing pages of
PytestCollectionWarning output.
Classes fixed:
- `TestResult`, `TestCaseSummary`, `TestSessionState` in
`backends/test/suite/reporting.py`
- `Tester` in `backends/xnnpack/test/tester/tester.py`
- `TestCat` in `exir/tests/test_prune_empty_tensors_pass.py`
- `TestModel1` in `exir/tests/test_remove_view_copy.py`
### Test plan
Ran `pytest --collect-only` before and after the changes. Before:
multiple PytestCollectionWarning lines for each of these classes. After:
0 warnings found.
To verify:
```bash
pytest --collect-only 2>&1 | python -c "import sys; lines=[l for l in sys.stdin if 'PytestCollectionWarning' in l]; print(f'{len(lines)} warnings found')"1 parent 69ae8c5 commit bc069d5
4 files changed
Lines changed: 12 additions & 0 deletions
File tree
- backends
- test/suite
- xnnpack/test/tester
- exir/tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
155 | 157 | | |
156 | 158 | | |
157 | 159 | | |
| 160 | + | |
| 161 | + | |
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
| |||
210 | 214 | | |
211 | 215 | | |
212 | 216 | | |
| 217 | + | |
| 218 | + | |
213 | 219 | | |
214 | 220 | | |
215 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
0 commit comments