""" Regression tests for functionality that we assume to be working for our analysis. """ import pytest from sfdata import SFDataFiles, sfdatafile, SFScanInfo import tracemalloc @pytest.mark.regression def test_JU_memory(): base_path = "/sf/cristallina/data/p19739/raw/" run_number = 49 averages = [] tracemalloc.start() current, peak = tracemalloc.get_traced_memory() print(f"Current memory usage is {current / 10**6:.1f}MB; Peak was {peak / 10**6:.1f}MB") with SFDataFiles(f"{base_path}/run{run_number:04}/data/acq00*.h5") as data: ch = data["JF16T03V01"] current, peak = tracemalloc.get_traced_memory() print(f"Current memory usage is {current / 10**6:.1f}MB; Peak was {peak / 10**6:.1f}MB") tracemalloc.stop() assert current/10**6 < 100, "Memory consumption should be below 100 MB"