Skip to content
Snippets Groups Projects
test_gotthard2lib.py 1.01 KiB
import pytest

from cal_tools.gotthard2.gotthard2lib import sort_dark_runs_by_gain

# TODO: Uncomment when test proposal have GH2 dark runs.
# xcaltst has no permission to access other than CALLAB RAW data.
# @pytest.mark.requires_gpfs
# def test_sort_dark_runs_by_gain():
#     raw_folder = "/gpfs/exfel/exp/FXE/202231/p900298/raw"
#     ctrl_src = "FXE_XAD_G2XES/DET/CONTROL"
#     runs = [9, 8, 7]
#     sorted_runs = sort_dark_runs_by_gain(raw_folder, runs, ctrl_src)
#     assert sorted_runs == [7, 8, 9]


# @pytest.mark.requires_gpfs
# def test_raise_sort_dark_runs_by_gain():
#     raw_folder = "/gpfs/exfel/exp/SA1/202331/p900384/raw"
#     ctrl_src = "SA1_XTD9_HIREX/DET/GOTTHARD2_CTRL"
#     runs = [60, 61, 62, 63]
#     with pytest.raises(AssertionError):  # More than 3 runs
#         sort_dark_runs_by_gain(raw_folder, runs, ctrl_src)

#     runs = [89, 61, 63]  # dynamicgain, dynamicgain, fixgain2
#     with pytest.raises(ValueError):  # Two high gain runs
#         sort_dark_runs_by_gain(raw_folder, runs, ctrl_src)