-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Description
I'm a Dask maintainer and I'm currently working on 3.14t support.
My test suite runs Dask with the default threading scheduler on 3.14t.
Dask spawns a thread, logs a RuntimeWarning inside the thread, and then joins it.
On all other Python interpreters, @pytest.mark.filterwarnings successfully suppresses the warning.
On Python 3.14t, if any other test previously spawned and rejoined dask threads, the warning is not suppressed.
Reproducer
import dask.array as da
import pytest
def test_1():
a = da.zeros(1)
a.compute()
@pytest.mark.filterwarnings("ignore:invalid value encountered in divide:RuntimeWarning")
def test_2():
a = da.zeros(1) / da.zeros(1)
a.compute()Outcome:
- Python 3.14.2,
pytest: OK - Python 3.14.2t,
pytest -k test_2: OK - Python 3.14.2t,
pytest:
FAILED test1.py::test_2 - RuntimeWarning: invalid value encountered in divide
- Python 3.14.2,
pytest, changecompute()tocompute(scheduler="sync"): OK
I've failed to further simplify the reproducer further. This works fine:
import numpy as np
import pytest
import threading
import dask.array as da
def test_1():
a = da.zeros(1)
a.compute()
@pytest.mark.filterwarnings("ignore:invalid value encountered in divide:RuntimeWarning")
def test2():
t = threading.Thread(target=np.divide, args=(0, 0))
t.start()
t.join()If I merge the two tests, ending up with a single test that spawns and destroys the dask thread pool twice, the issue disappears. This works fine:
import dask.array as da
import pytest
@pytest.mark.filterwarnings("ignore:invalid value encountered in divide:RuntimeWarning")
def test_1():
a = da.zeros(1)
a.compute()
a = da.zeros(1) / da.zeros(1)
a.compute()Environment
pytest 9.0.2
numpy 2.4.0
dask 2025.12.0
Python 3.14.2
Metadata
Metadata
Assignees
Labels
No labels