Source code for ewoksmx.tests.shell_utils.test_execute_dozor_local

import logging

import pytest
from esrf_pathlib import ESRFPath

from ewoksmx.shell_utils.execute_local import execute_bash_commands


[docs] @pytest.fixture def sample_dozor_dat(): data_dir = ESRFPath("/data/scisoft/edna2/svensson/images") if not data_dir.exists(): pytest.skip(f"Required path not found: {data_dir}") name_template_image = data_dir / "x_1_????.cbf" dozor_dat = f"""! detector pilatus6m library /cvmfs/sb.esrf.fr/software/packages/ubuntu20.04/x86_64/xds-zcbf/20200922/xds-zcbf.so nx 2463 ny 2527 pixel 0.172000 exposure 0.100 spot_size 3 spot_level 6 detector_distance 269.600 X-ray_wavelength 0.976 fraction_polarization 0.990 pixel_min 0 pixel_max 64000 ix_min 1980 ix_max 2100 iy_min 2067 iy_max 4362 orgx 1216.9 orgy 1260.0 oscillation_range 0.200 image_step 0.200 starting_angle 92.151 first_image_number 1 number_images 10 name_template_image {name_template_image} end """ return dozor_dat
[docs] def test_execute_dozor_success(sample_dozor_dat, tmp_path, caplog): # Write dozor.dat file in temporary directory dozor_dat_path = tmp_path / "dozor.dat" with open(dozor_dat_path, "w") as f: f.write(sample_dozor_dat) commands = [ "ulimit -c unlimited", "module load dozor", "dozor -pall -mesh -p dozor.dat", ] result = execute_bash_commands(commands, tmp_path) result.print() with caplog.at_level(logging.DEBUG): result.log() log_txt = result.read_log() result.raise_on_error() assert "Program dozor /A.Popov & G.Bourenkov/" in log_txt assert " 10 |" in log_txt