Skip to content

Commit

Permalink
DOC: discuss pytest assertion rewrites in README
Browse files Browse the repository at this point in the history
  • Loading branch information
ev-br committed Jun 23, 2024
1 parent c1d4b25 commit 31d4ac6
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,6 @@ and [a doctest example](https://github.com/scipy/scipy_doctest/blob/main/scipy_d
for more details.


### The SciPy Doctest Pytest Plugin

The pytest plugin enables the use of `scipy_doctest` tools to perform doctests.

Follow the given instructions to utilize the pytest plugin for doctesting.

### NumPy and SciPy wrappers


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


- *`pytest`'s assertion rewriting*

In some rare cases you may need to either explicitly register the `scipy_doctest`
package with the `pytest` assertion rewriting machinery, or ask it to avoid rewriting
completely, via `pytest --assert=plain`.
See [the `pytest documentation`](https://docs.pytest.org/en/7.1.x/how-to/assert.html)
for more details.

In general, rewriting assertions is not very useful for doctests, as the
output on error is fixed by the doctest machinery anyway. Therefore, we believe
adding `--assert=plain` is a safe.


## Prior art and related work

- `pytest` provides some limited floating-point aware `NumericLiteralChecker`.
Expand Down

0 comments on commit 31d4ac6

Please sign in to comment.