forked from Cephla-Lab/stitcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
32 lines (22 loc) · 784 Bytes
/
conftest.py
File metadata and controls
32 lines (22 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Pytest configuration and shared fixtures."""
import numpy as np
import pytest
@pytest.fixture
def rng():
"""Seeded random number generator for reproducible tests."""
return np.random.default_rng(42)
@pytest.fixture
def sample_tile(rng):
"""Generate a sample tile image."""
return rng.random((100, 100), dtype=np.float32) * 65535
@pytest.fixture
def sample_multichannel_tile(rng):
"""Generate a sample multi-channel tile."""
return rng.random((3, 100, 100), dtype=np.float32) * 65535
@pytest.fixture
def force_cpu(monkeypatch):
"""Force CPU fallback by setting CUDA_AVAILABLE to False."""
import tilefusion.utils as utils
monkeypatch.setattr(utils, "CUDA_AVAILABLE", False)
yield
# monkeypatch automatically restores after test