Skip to content

Commit

Permalink
Merge pull request #375 from cydanil/fix/voview_context_manager
Browse files Browse the repository at this point in the history
Set ctx_closes when opening run using voview
  • Loading branch information
cydanil authored Jan 27, 2023
2 parents 2ae9f5e + 494f61a commit 9b4e5b7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion extra_data/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions extra_data/tests/test_voview.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def find_version(*parts):
'pytest',
'pytest-cov',
'testpath',
'psutil',
]
},
python_requires='>=3.6',
Expand Down

0 comments on commit 9b4e5b7

Please sign in to comment.