add a pytest.ini file (#53152)
Summary:
This shall fix the first three items of https://github.com/pytorch/pytorch/issues/52984 by adding a pytest.ini configuration file.
#### `--tb=short`
In a failure, pytest will not show the entire traceback nor the docstring.
- Without `--tb=short`:
<details>
```
$ pytest test/test_typing.py -k tensor_copy
================================================================== test session starts ===================================================================
platform linux -- Python 3.8.6, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: /home/guilhermel/git/pytorch, configfile: pytest.ini
plugins: hypothesis-5.38.1, typeguard-2.10.0
collected 8 items / 7 deselected / 1 selected
test/test_typing.py F [100%]
======================================================================== FAILURES ========================================================================
______________________________________________________________ test_reveal[tensor_copy.py] _______________________________________________________________
path = '/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py', reveal = 'int '
expected_reveal = "/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py:11: note: Revealed type is 'torch.tensor.Tensor'", lineno = 11
def _test_reveal(path: str, reveal: str, expected_reveal: str, lineno: int) -> None:
if reveal not in expected_reveal:
> raise AssertionError(_REVEAL_MSG.format(lineno, expected_reveal, reveal))
E AssertionError: Reveal mismatch at line 11
E
E Expected reveal: "/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py:11: note: Revealed type is 'torch.tensor.Tensor'"
E Observed reveal: 'int '
test/test_typing.py:156: AssertionError
================================================================ short test summary info =================================================================
FAILED test/test_typing.py::test_reveal[tensor_copy.py] - AssertionError: Reveal mismatch at line 11
```
</details>
- With `--tb=short`:
<details>
```
$ pytest test/test_typing.py -k tensor_copy
================================================================== test session starts ===================================================================
platform linux -- Python 3.8.6, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: /home/guilhermel/git/pytorch, configfile: pytest.ini
plugins: hypothesis-5.38.1, typeguard-2.10.0
collected 8 items / 7 deselected / 1 selected
test/test_typing.py F [100%]
======================================================================== FAILURES ========================================================================
______________________________________________________________ test_reveal[tensor_copy.py] _______________________________________________________________
test/test_typing.py:156: in _test_reveal
raise AssertionError(_REVEAL_MSG.format(lineno, expected_reveal, reveal))
E AssertionError: Reveal mismatch at line 11
E
E Expected reveal: "/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py:11: note: Revealed type is 'torch.tensor.Tensor'"
E Observed reveal: 'int '
```
</details>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53152
Reviewed By: agolynski
Differential Revision: D26846808
Pulled By: walterddr
fbshipit-source-id: d16c951b370b0643c8bbedca73d5184c6b65aba7
2021-03-19 00:38:14 +00:00
|
|
|
[pytest]
|
|
|
|
|
addopts =
|
|
|
|
|
# show summary of all tests that did not pass
|
2022-07-27 19:43:30 +00:00
|
|
|
-rEfX
|
add a pytest.ini file (#53152)
Summary:
This shall fix the first three items of https://github.com/pytorch/pytorch/issues/52984 by adding a pytest.ini configuration file.
#### `--tb=short`
In a failure, pytest will not show the entire traceback nor the docstring.
- Without `--tb=short`:
<details>
```
$ pytest test/test_typing.py -k tensor_copy
================================================================== test session starts ===================================================================
platform linux -- Python 3.8.6, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: /home/guilhermel/git/pytorch, configfile: pytest.ini
plugins: hypothesis-5.38.1, typeguard-2.10.0
collected 8 items / 7 deselected / 1 selected
test/test_typing.py F [100%]
======================================================================== FAILURES ========================================================================
______________________________________________________________ test_reveal[tensor_copy.py] _______________________________________________________________
path = '/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py', reveal = 'int '
expected_reveal = "/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py:11: note: Revealed type is 'torch.tensor.Tensor'", lineno = 11
def _test_reveal(path: str, reveal: str, expected_reveal: str, lineno: int) -> None:
if reveal not in expected_reveal:
> raise AssertionError(_REVEAL_MSG.format(lineno, expected_reveal, reveal))
E AssertionError: Reveal mismatch at line 11
E
E Expected reveal: "/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py:11: note: Revealed type is 'torch.tensor.Tensor'"
E Observed reveal: 'int '
test/test_typing.py:156: AssertionError
================================================================ short test summary info =================================================================
FAILED test/test_typing.py::test_reveal[tensor_copy.py] - AssertionError: Reveal mismatch at line 11
```
</details>
- With `--tb=short`:
<details>
```
$ pytest test/test_typing.py -k tensor_copy
================================================================== test session starts ===================================================================
platform linux -- Python 3.8.6, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: /home/guilhermel/git/pytorch, configfile: pytest.ini
plugins: hypothesis-5.38.1, typeguard-2.10.0
collected 8 items / 7 deselected / 1 selected
test/test_typing.py F [100%]
======================================================================== FAILURES ========================================================================
______________________________________________________________ test_reveal[tensor_copy.py] _______________________________________________________________
test/test_typing.py:156: in _test_reveal
raise AssertionError(_REVEAL_MSG.format(lineno, expected_reveal, reveal))
E AssertionError: Reveal mismatch at line 11
E
E Expected reveal: "/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py:11: note: Revealed type is 'torch.tensor.Tensor'"
E Observed reveal: 'int '
```
</details>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53152
Reviewed By: agolynski
Differential Revision: D26846808
Pulled By: walterddr
fbshipit-source-id: d16c951b370b0643c8bbedca73d5184c6b65aba7
2021-03-19 00:38:14 +00:00
|
|
|
# Make tracebacks shorter
|
|
|
|
|
--tb=native
|
|
|
|
|
# capture only Python print and C++ py::print, but not C output (low-level Python errors)
|
|
|
|
|
--capture=sys
|
2022-10-05 03:08:51 +00:00
|
|
|
# don't suppress warnings, but don't shove them all to the end either
|
|
|
|
|
-p no:warnings
|
2024-01-23 18:39:30 +00:00
|
|
|
# Use custom pytest shard located in test/pytest_shard_custom.py instead
|
|
|
|
|
-p no:pytest-shard
|
2024-01-10 20:02:41 +00:00
|
|
|
# don't rewrite assertions (usually not a problem in CI due to differences in imports, see #95844)
|
|
|
|
|
--assert=plain
|
add a pytest.ini file (#53152)
Summary:
This shall fix the first three items of https://github.com/pytorch/pytorch/issues/52984 by adding a pytest.ini configuration file.
#### `--tb=short`
In a failure, pytest will not show the entire traceback nor the docstring.
- Without `--tb=short`:
<details>
```
$ pytest test/test_typing.py -k tensor_copy
================================================================== test session starts ===================================================================
platform linux -- Python 3.8.6, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: /home/guilhermel/git/pytorch, configfile: pytest.ini
plugins: hypothesis-5.38.1, typeguard-2.10.0
collected 8 items / 7 deselected / 1 selected
test/test_typing.py F [100%]
======================================================================== FAILURES ========================================================================
______________________________________________________________ test_reveal[tensor_copy.py] _______________________________________________________________
path = '/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py', reveal = 'int '
expected_reveal = "/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py:11: note: Revealed type is 'torch.tensor.Tensor'", lineno = 11
def _test_reveal(path: str, reveal: str, expected_reveal: str, lineno: int) -> None:
if reveal not in expected_reveal:
> raise AssertionError(_REVEAL_MSG.format(lineno, expected_reveal, reveal))
E AssertionError: Reveal mismatch at line 11
E
E Expected reveal: "/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py:11: note: Revealed type is 'torch.tensor.Tensor'"
E Observed reveal: 'int '
test/test_typing.py:156: AssertionError
================================================================ short test summary info =================================================================
FAILED test/test_typing.py::test_reveal[tensor_copy.py] - AssertionError: Reveal mismatch at line 11
```
</details>
- With `--tb=short`:
<details>
```
$ pytest test/test_typing.py -k tensor_copy
================================================================== test session starts ===================================================================
platform linux -- Python 3.8.6, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: /home/guilhermel/git/pytorch, configfile: pytest.ini
plugins: hypothesis-5.38.1, typeguard-2.10.0
collected 8 items / 7 deselected / 1 selected
test/test_typing.py F [100%]
======================================================================== FAILURES ========================================================================
______________________________________________________________ test_reveal[tensor_copy.py] _______________________________________________________________
test/test_typing.py:156: in _test_reveal
raise AssertionError(_REVEAL_MSG.format(lineno, expected_reveal, reveal))
E AssertionError: Reveal mismatch at line 11
E
E Expected reveal: "/home/guilhermel/git/pytorch/test/typing/reveal/tensor_copy.py:11: note: Revealed type is 'torch.tensor.Tensor'"
E Observed reveal: 'int '
```
</details>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53152
Reviewed By: agolynski
Differential Revision: D26846808
Pulled By: walterddr
fbshipit-source-id: d16c951b370b0643c8bbedca73d5184c6b65aba7
2021-03-19 00:38:14 +00:00
|
|
|
testpaths =
|
|
|
|
|
test
|
2022-07-19 19:50:57 +00:00
|
|
|
junit_logging_reruns = all
|
2023-02-28 22:09:01 +00:00
|
|
|
filterwarnings =
|
|
|
|
|
ignore:Module already imported so cannot be rewritten.*hypothesis:pytest.PytestAssertRewriteWarning
|
2023-10-27 23:53:32 +00:00
|
|
|
|
|
|
|
|
xfail_strict = True
|
2024-04-17 00:23:42 +00:00
|
|
|
|
|
|
|
|
markers =
|
|
|
|
|
serial: marks tests as needs to be run serially (deselect with '-m "not serial"')
|