Skip to content

Commit

Permalink
Remove dxtbx procrunner dependency (#640)
Browse files Browse the repository at this point in the history
There is no longer any reason to use procrunner in place of built-in subprocess
  • Loading branch information
rjgildea authored Jun 16, 2023
1 parent 700bb2e commit e7b27b4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion .azure-pipelines/ci-conda-env.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ conda-forge::orderedset
conda-forge::pillow>=5.4.1
conda-forge::pint
conda-forge::pip
conda-forge::procrunner
conda-forge::psutil
conda-forge::pyrtf
conda-forge::pybind11
Expand Down
1 change: 0 additions & 1 deletion libtbx_config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"python_required": [
"dials-data>=2.0.30",
"pint",
"procrunner>=1.0.2",
"pytest>=4.5,<5.0",
],
}
1 change: 1 addition & 0 deletions newsfragments/640.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use Python built-in ``subprocess`` in place of external dependency ``procrunner`` for running CLI tests.
14 changes: 8 additions & 6 deletions tests/command_line/test_average.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from __future__ import annotations

import procrunner
import shutil
import subprocess

import pytest

import dxtbx


@pytest.mark.parametrize("use_mpi", [True, False])
def test_average(dials_data, tmpdir, use_mpi):
def test_average(dials_data, tmp_path, use_mpi):
# averager uses cbf handling code in the xfel module
pytest.importorskip("xfel")

Expand All @@ -22,16 +24,16 @@ def test_average(dials_data, tmpdir, use_mpi):
command = "mpirun"
mpargs = "-n 2 dxtbx.image_average --mpi=True".split()
else:
command = "dxtbx.image_average"
command = shutil.which("dxtbx.image_average")
mpargs = "-n 2".split()
result = procrunner.run(
result = subprocess.run(
[command] + mpargs + "-v -a avg.cbf -s stddev.cbf -m max.cbf".split() + [data],
working_directory=tmpdir,
cwd=tmp_path,
)
assert not result.returncode and not result.stderr

h5 = dxtbx.load(data).get_detector()
cbf = dxtbx.load(tmpdir.join("avg.cbf")).get_detector()
cbf = dxtbx.load(tmp_path / "avg.cbf").get_detector()

assert h5.is_similar_to(cbf)
assert h5[0].get_gain() == cbf[0].get_gain()

0 comments on commit e7b27b4

Please sign in to comment.