Repository: European-XFEL/EXtra-data

Issue:
Run opened from virtual overview file is not considered a single run
Something we noticed today while debugging an issue in offline calibration.

The fix is very easy, but ideally we can also add a test that would have caught this (e.g. load a virtual overview file and ensure we can use `.get_run_value()`.

Discussion:

Patch:
diff --git a/extra_data/reader.py b/extra_data/reader.py
index f6bfe55..3803896 100644
--- a/extra_data/reader.py
+++ b/extra_data/reader.py
@@ -1419,7 +1419,7 @@ def RunDirectory(
     if _use_voview and (sel_files == files):
         voview_file_acc = voview.find_file_valid(path)
         if voview_file_acc is not None:
-            return DataCollection([voview_file_acc])
+            return DataCollection([voview_file_acc], is_single_run=True)
 
     files_map = RunFilesMap(path)
     t0 = time.monotonic()


Test patch:
diff --git a/extra_data/tests/test_voview.py b/extra_data/tests/test_voview.py
index 5f9d103..3f0bb96 100644
--- a/extra_data/tests/test_voview.py
+++ b/extra_data/tests/test_voview.py
@@ -29,6 +29,8 @@ def test_use_voview(mock_spb_raw_run, tmp_path):
     run = RunDirectory(str(new_run_dir))
     assert [f.filename for f in run.files] == [str(voview_file)]
     assert len(run.train_ids) == 64
+    assert run.run_metadata()['dataFormatVersion'] == \
+           run_orig.run_metadata()['dataFormatVersion']
 
     assert 'SPB_DET_AGIPD1M-1/DET/0CH0:xtdf' in run.instrument_sources
     assert 'SA1_XTD2_XGM/DOOCS/MAIN' in run.control_sources