Commit df9d69ea authored by Piergiorgio Pancino's avatar Piergiorgio Pancino
Browse files

silx_view: add test to check stdout of process

parent 0747a8ba
...@@ -804,13 +804,18 @@ def newdataset(dataset_name=None): ...@@ -804,13 +804,18 @@ def newdataset(dataset_name=None):
def silx_view(scan: typing.Union[scans.Scan, None] = None): def silx_view(scan: typing.Union[scans.Scan, None] = None):
"""Open silx view on a given scan (default last scan)""" """Open silx view on a given scan (default last scan)"""
args = f"{sys.executable} -m silx.app.view.main".split() filename = None
try: try:
if scan is None: if scan is None:
scan = current_session.scans[-1] scan = current_session.scans[-1]
filename = scan._scan_info["filename"] filename = scan._scan_info["filename"]
except IndexError: except IndexError:
pass pass
else: _launch_silx(filename)
def _launch_silx(filename: typing.Union[str, None] = None):
args = f"{sys.executable} -m silx.app.view.main".split()
if filename:
args.append(filename) args.append(filename)
subprocess.Popen(args) return subprocess.Popen(args)
import logging import logging
import subprocess import subprocess
import time
import pytest import pytest
from bliss.shell.standard import wa, wm, sta, stm, umvr, lprint, sync from bliss.shell.standard import wa, wm, sta, stm, _launch_silx
@pytest.fixture @pytest.fixture
...@@ -230,3 +231,11 @@ def test_sync_lib_mode(capsys, default_session): ...@@ -230,3 +231,11 @@ def test_sync_lib_mode(capsys, default_session):
assert returncode == 0 assert returncode == 0
assert len(err) == 0 assert len(err) == 0
def test_open_silx(xvfb):
# checking if the process opens without stdout errors
process = _launch_silx()
time.sleep(1)
assert process.returncode is None
process.terminate()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment