From b8e0ab7459f9624ebda1d2306e7105faa0dfc461 Mon Sep 17 00:00:00 2001 From: ptweezy Date: Tue, 27 Oct 2026 16:12:38 -0400 Subject: [PATCH] Test that igzip_threaded.open() starts the given number of threads No test checked that open() passes threads to the writer. Without it, the writer uses one thread, and the threaded tests still passed. --- tests/test_igzip_threaded.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_igzip_threaded.py b/tests/test_igzip_threaded.py index dd26e95e..00e6ba68 100644 --- a/tests/test_igzip_threaded.py +++ b/tests/test_igzip_threaded.py @@ -63,6 +63,13 @@ def test_threaded_open_no_threads(): assert isinstance(klass, gzip.GzipFile) +def test_threaded_open_threads(): + with igzip_threaded.open(io.BytesIO(), "wb", threads=3) as f: + workers = f.raw.compression_workers + assert len(workers) == 3 + assert all(worker.is_alive() for worker in workers) + + def test_threaded_open_not_a_file_or_pathlike(): i_am_a_tuple = (1, 2, 3) with pytest.raises(TypeError) as error: