Skip to content

Commit 9b4e5b7

Browse files
authored
Merge pull request #375 from cydanil/fix/voview_context_manager
Set ctx_closes when opening run using voview
2 parents 2ae9f5e + 494f61a commit 9b4e5b7

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

extra_data/reader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,9 @@ def RunDirectory(
13981398
if _use_voview and (sel_files == files):
13991399
voview_file_acc = voview.find_file_valid(path)
14001400
if voview_file_acc is not None:
1401-
return DataCollection([voview_file_acc], is_single_run=True)
1401+
return DataCollection([voview_file_acc],
1402+
is_single_run=True,
1403+
ctx_closes=True)
14021404

14031405
files_map = RunFilesMap(path)
14041406
t0 = time.monotonic()

extra_data/tests/test_voview.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ def test_use_voview(mock_spb_raw_run, tmp_path):
3535
assert 'SPB_DET_AGIPD1M-1/DET/0CH0:xtdf' in run.instrument_sources
3636
assert 'SA1_XTD2_XGM/DOOCS/MAIN' in run.control_sources
3737

38+
with RunDirectory(str(new_run_dir)) as run:
39+
assert 'SPB_DET_AGIPD1M-1/DET/0CH0:xtdf' in run.instrument_sources
40+
assert 'SA1_XTD2_XGM/DOOCS/MAIN' in run.control_sources
41+
3842

3943
def open_run_with_voview(run_src, new_run_dir):
4044
copytree(run_src, new_run_dir)

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def find_version(*parts):
7676
'pytest',
7777
'pytest-cov',
7878
'testpath',
79+
'psutil',
7980
]
8081
},
8182
python_requires='>=3.6',

0 commit comments

Comments
 (0)