Hi,

Following on your idea here I can reproduce the segfault in unstable w/o nxtomomill at all. In a mostly empty unstable Docker I see:

```
$ cat x.py
import pytest
from tqdm import tqdm

@pytest.mark.parametrize("progress", (None, tqdm(desc="hola")))
def test_poc(progress):
    if progress is not None:
        progress.total = 100
        progress.n = 20
        progress.refresh()
    assert 1==1
$ pytest x.py
============================================================== test session starts ===============================================================
platform linux -- Python 3.13.4, pytest-8.3.5, pluggy-1.5.0
rootdir: /x
collected 2 items

x.py .. [100%]

=============================================================== 2 passed in 0.02s ================================================================
Segmentation fault (core dumped)
$ dpkg -l|grep tqdm
ii python3-tqdm 4.67.1-5 all fast, extensible progress bar for Python 3 and CLI tool
```

So it seems this is indeed due some pytest--tqdm interaction; maybe something to do with how the former creates parameter lists early during module setup time, I'm not sure.

However if tqdm is needed to be tested with, but its output can be omitted then `tqdm(..., disable=True)` makes the test work.

Alternatively one can postpone tqdm initialization:

```
...
@pytest.mark.parametrize("progress", (None, lambda: tqdm(desc="hola")))
def test_poc(progress):
    if progress is not None:
        progress = progress()
...
```

I can't find any details/prohibitions of tqdm use in pytest manuals and I'm unsure if this actually is a tqdm bug, but maybe the workaround can be filed against nxtomomill?

BR,
Gábor

Reply via email to