- Use spawn in stead of fork so that any jvm will not exist in any child processes and block them from stopping.

- Use poetry for install.
This commit is contained in:
Wim Pomp
2023-03-31 12:01:25 +02:00
parent 4fceb59867
commit 6689b1eab3
7 changed files with 122 additions and 102 deletions

16
tests/test_multiple.py Normal file
View File

@@ -0,0 +1,16 @@
import numpy as np
from tiffwrite import IJTiffFile
from itertools import product
from contextlib import ExitStack
from tqdm.auto import tqdm
def test_mult(tmp_path):
shape = (3, 5, 12)
paths = [tmp_path / f'test{i}.tif' for i in range(8)]
with ExitStack() as stack:
tifs = [stack.enter_context(IJTiffFile(path, shape)) for path in paths]
for c, z, t in tqdm(product(range(shape[0]), range(shape[1]), range(shape[2])), total=np.prod(shape)):
for tif in tifs:
tif.save(np.random.randint(0, 255, (1024, 1024)), c, z, t)
assert all([path.exists() for path in paths])

11
tests/test_single.py Normal file
View File

@@ -0,0 +1,11 @@
import numpy as np
from tiffwrite import IJTiffFile
from itertools import product
def test_single(tmp_path):
path = tmp_path / 'test.tif'
with IJTiffFile(path, (3, 4, 5)) as tif:
for c, z, t in product(range(3), range(4), range(5)):
tif.save(np.random.randint(0, 255, (64, 64)), c, z, t)
assert path.exists()