From d3d27b6929488ae2ce806862684298ab9482015c Mon Sep 17 00:00:00 2001 From: Cyril Danilevski Date: Thu, 26 Jan 2023 17:56:51 +0100 Subject: [PATCH 1/2] Set ctx_closes when opening DataCollection from voview file --- extra_data/reader.py | 4 +++- extra_data/tests/test_voview.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/extra_data/reader.py b/extra_data/reader.py index 21ad0f45..90643e50 100644 --- a/extra_data/reader.py +++ b/extra_data/reader.py @@ -1398,7 +1398,9 @@ 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], is_single_run=True) + return DataCollection([voview_file_acc], + is_single_run=True, + ctx_closes=True) files_map = RunFilesMap(path) t0 = time.monotonic() diff --git a/extra_data/tests/test_voview.py b/extra_data/tests/test_voview.py index 3f0bb966..31798025 100644 --- a/extra_data/tests/test_voview.py +++ b/extra_data/tests/test_voview.py @@ -35,6 +35,10 @@ def test_use_voview(mock_spb_raw_run, tmp_path): assert 'SPB_DET_AGIPD1M-1/DET/0CH0:xtdf' in run.instrument_sources assert 'SA1_XTD2_XGM/DOOCS/MAIN' in run.control_sources + with RunDirectory(str(new_run_dir)) as run: + assert 'SPB_DET_AGIPD1M-1/DET/0CH0:xtdf' in run.instrument_sources + assert 'SA1_XTD2_XGM/DOOCS/MAIN' in run.control_sources + def open_run_with_voview(run_src, new_run_dir): copytree(run_src, new_run_dir) From 494f61ab7e6410b588e178a164663c3624eb4711 Mon Sep 17 00:00:00 2001 From: Cyril Danilevski Date: Thu, 26 Jan 2023 17:57:07 +0100 Subject: [PATCH 2/2] Add psutil as test dependency --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 4237df09..1e974b9e 100755 --- a/setup.py +++ b/setup.py @@ -76,6 +76,7 @@ def find_version(*parts): 'pytest', 'pytest-cov', 'testpath', + 'psutil', ] }, python_requires='>=3.6',