pytest-dev / pytest-dev/pytest

doctest options NUMBER and ELLIPSIS seem incompatible

Open
#13,327 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

plugin: doctests
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using (uv tree used)
  • pytest and operating system versions
  • minimal example if possible

The NUMBER option supplied by pytest (https://docs.pytest.org/en/stable/how-to/doctest.html#using-doctest-options) seems incompatible with ELLIPSIS from doctest. That is, I can't seem to shorten outputs in non-exception output with ... while having any float outputs respect rounding.

I have a minimal example with virtual environment at https://github.com/wade-cheng/pytest-doctest-bug. Hopefully this makes reproduction easy.

pytest is the only dependency. uv tree shows

pytest-doctest-bug v0.1.0
└── pytest v8.3.5
    ├── exceptiongroup v1.2.2
    ├── iniconfig v2.1.0
    ├── packaging v24.2
    ├── pluggy v1.5.0
    └── tomli v2.2.1

I have OS

Ubuntu 22.04.5 LTS
64-bit
GNOME Version: 42.9
X11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproduction at https://github.com/wade-cheng/pytest-doctest-bug and the pytest doctest options documentation linked in the issue. Reproduce the interaction between NUMBER and ELLIPSIS, then trace the relevant doctest handling; done means both options work together for shortened non-exception output and rounded floats.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.