Commit 3c5bd335 authored by Henri Payno's avatar Henri Payno
Browse files

[app] improve test to call main() instead of subprocess

parent cc569556
Pipeline #53952 passed with stages
in 4 minutes and 19 seconds
......@@ -168,7 +168,6 @@ def main(argv):
file_keys=file_keys,
progress=Progress(""),
)
exit(0)
if __name__ == "__main__":
......
......@@ -377,7 +377,6 @@ def main(argv):
input_callback=None,
detector_sel_callback=callback_det_sel,
)
exit(0)
if __name__ == "__main__":
......
......@@ -36,6 +36,7 @@ __date__ = "30/08/2021"
import tempfile
from nxtomomill.test.utils.dxfile import MockDxFile
from nxtomomill.app.dxfile2nx import main
import os
import subprocess
......@@ -56,8 +57,5 @@ def test_dxfile2nx_application():
n_flats=n_flats,
)
assert not os.path.exists(nx_file_path), "outputfile exists already"
process = subprocess.Popen(
["nxtomomill", "dxfile2nx", dx_file_path, nx_file_path]
)
stdout, stderr = process.communicate()
main(["dxfile2nx", dx_file_path, nx_file_path])
assert os.path.exists(nx_file_path), "outputfile doesn't exists"
......@@ -36,6 +36,7 @@ __date__ = "30/08/2021"
import tempfile
from tomoscan.esrf.mock import MockEDF
from nxtomomill.app.edf2nx import main
import os
import subprocess
......@@ -53,6 +54,5 @@ def test_edf2nx_application():
output_file = os.path.join(edf_acq_path, "nexus_file.nx")
assert not os.path.exists(output_file), "output_file exists already"
process = subprocess.Popen(["nxtomomill", "edf2nx", edf_acq_path, output_file])
stdout, stderr = process.communicate()
main(["edf2nx", edf_acq_path, output_file])
assert os.path.exists(output_file), "output_file doesn't exists"
......@@ -36,6 +36,7 @@ __date__ = "30/08/2021"
import tempfile
from nxtomomill.test.utils.bliss import MockBlissAcquisition
from nxtomomill.app.h52nx import main
import os
import subprocess
......@@ -58,8 +59,5 @@ def test_h52nx_application():
h5_file_path = bliss_mock.samples[0].sample_file
assert not os.path.exists(nx_file_path), "outputfile exists already"
process = subprocess.Popen(
["nxtomomill", "h52nx", h5_file_path, nx_file_path, "--single-file"]
)
stdout, stderr = process.communicate()
main(["h52nx", h5_file_path, nx_file_path, "--single-file"])
assert os.path.exists(nx_file_path), "outputfile doesn't exists"
......@@ -36,6 +36,7 @@ __date__ = "30/08/2021"
import tempfile
from tomoscan.esrf.mock import MockHDF5
from nxtomomill.app.patch_nx import main
import h5py
import os
import subprocess
......@@ -57,9 +58,8 @@ def test_patch_nx_application():
create_final_ref=False,
dim=dim,
).scan
process = subprocess.Popen(
main(
[
"nxtomomill",
"patch-nx",
scan.master_file,
"entry",
......@@ -67,6 +67,5 @@ def test_patch_nx_application():
"0:12",
]
)
stdout, stderr = process.communicate()
scan.clear_caches()
assert len(scan.projections) == 8, "Scan is expected to have 8 projections now"
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