Skip to content

Commit 8ce7452

Browse files
committed
DOC: discuss pytest assertion rewrites in README
1 parent c1d4b25 commit 8ce7452

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,6 @@ and [a doctest example](https://github.com/scipy/scipy_doctest/blob/main/scipy_d
272272
for more details.
273273

274274

275-
### The SciPy Doctest Pytest Plugin
276-
277-
The pytest plugin enables the use of `scipy_doctest` tools to perform doctests.
278-
279-
Follow the given instructions to utilize the pytest plugin for doctesting.
280-
281275
### NumPy and SciPy wrappers
282276

283277

@@ -363,6 +357,19 @@ leads to
363357
- `scipy.linalg.det`, collected from `scipy/linalg/__init__.py`, is public.
364358

365359

360+
- *`pytest`'s assertion rewriting*
361+
362+
In some rare cases you may need to either explicitly register the `scipy_doctest`
363+
package with the `pytest` assertion rewriting machinery, or ask it to avoid rewriting
364+
completely, via `pytest --assert=plain`.
365+
See [the `pytest documentation`](https://docs.pytest.org/en/7.1.x/how-to/assert.html)
366+
for more details.
367+
368+
In general, rewriting assertions is not very useful for doctests, as the
369+
output on error is fixed by the doctest machinery anyway. Therefore, we believe
370+
adding `--assert=plain` is reasonable.
371+
372+
366373
## Prior art and related work
367374

368375
- `pytest` provides some limited floating-point aware `NumericLiteralChecker`.

0 commit comments

Comments
 (0)