diff --git a/src/ctapipe/tools/tests/test_merge.py b/src/ctapipe/tools/tests/test_merge.py index 09b3bca217e..e5eb70faec0 100644 --- a/src/ctapipe/tools/tests/test_merge.py +++ b/src/ctapipe/tools/tests/test_merge.py @@ -5,11 +5,12 @@ from pathlib import Path import numpy as np +import pytest import tables from astropy.table import vstack from astropy.utils.diff import report_diff_values -from ctapipe.core import run_tool +from ctapipe.core import ToolConfigurationError, run_tool from ctapipe.io import TableLoader from ctapipe.io.astropy_helpers import read_table from ctapipe.io.tests.test_astropy_helpers import assert_table_equal @@ -188,3 +189,22 @@ def test_muon(tmp_path, dl1_muon_output_file): assert len(table) == 2 * n_input assert_table_equal(table[:n_input], input_table) assert_table_equal(table[n_input:], input_table) + + +def test_duplicated(tmp_path, dl1_file, dl1_proton_file): + from ctapipe.tools.merge import MergeTool + + output = tmp_path / "invalid.dl1.h5" + with pytest.raises(ToolConfigurationError, match="Same file given multiple times"): + run_tool( + MergeTool(), + argv=[ + str(dl1_file), + str(dl1_proton_file), + str(dl1_file), + f"--output={output}", + "--overwrite", + ], + cwd=tmp_path, + raises=True, + )