Last active
November 5, 2020 15:35
-
-
Save alexfoias/52a356301b168f47abfc6e7ea5fd78ea to your computer and use it in GitHub Desktop.
pytest on 2193729161ef1b90d76eb2c4554eea4414532a34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[5/11/20 10:31:11] (base) alex@NeuroPoly-MacBook-Pro shimming-toolbox % git rev-parse origin/master | |
2193729161ef1b90d76eb2c4554eea4414532a34 | |
[5/11/20 10:29:24] (base) alex@NeuroPoly-MacBook-Pro shimming-toolbox % pytest | |
INFO:root:/Users/alex/code/shimming-toolbox/testing_data, testing_data | |
INFO:shimmingtoolbox.download:Trying URL: https://github.com/shimming-toolbox/data-testing/archive/r20201021.zip | |
INFO:shimmingtoolbox.download:Downloading: data-testing-r20201021.zip | |
Status: 11.4MB [00:02, 4.85MB/s] | |
INFO:shimmingtoolbox.download:Unzip data to: /var/folders/11/q0s99tk17rj_7jtmj1psydbr0000gn/T/st_download_a37h4cm7 | |
INFO:shimmingtoolbox.download:Removing temporary folders... | |
========================================================================================================================= test session starts ========================================================================================================================= | |
platform darwin -- Python 3.8.3, pytest-4.6.11, py-1.9.0, pluggy-0.13.1 | |
rootdir: /Users/alex/code/shimming-toolbox, inifile: pytest.ini | |
plugins: cov-2.5.1 | |
collected 62 items | |
test/test_biot_savart.py ... [ 4%] | |
test/test_dicom_to_nifti.py ... [ 9%] | |
test/test_example_scripts.py F [ 11%] | |
test/test_init.py . [ 12%] | |
test/test_load_nifti.py .....F.... [ 29%] | |
test/test_masking.py ...... [ 38%] | |
test/test_pmu.py ... [ 43%] | |
test/test_prelude.py EEEEEEEE [ 56%] | |
test/test_sequential_zslice.py . [ 58%] | |
test/test_siemens_basis.py .. [ 61%] | |
test/test_spherical_harmonics.py ... [ 66%] | |
test/cli/test_cli_dicom_to_nifti.py . [ 67%] | |
test/simulate/test_numerical_model.py .................... [100%] | |
=============================================================================================================================== ERRORS ================================================================================================================================ | |
__________________________________________________________________________________________________________ ERROR at setup of TestCore.test_default_works[0] ___________________________________________________________________________________________________________ | |
@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.prelude)]) | |
def test_prelude_installation(): | |
# note that subprocess.check_call() returns 0 on success, so it must be | |
# negated for the assertion. | |
> assert not subprocess.check_call(['which', 'prelude']) | |
conftest.py:40: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
popenargs = (['which', 'prelude'],), kwargs = {}, retcode = 1, cmd = ['which', 'prelude'] | |
def check_call(*popenargs, **kwargs): | |
"""Run command with arguments. Wait for command to complete. If | |
the exit code was zero then return, otherwise raise | |
CalledProcessError. The CalledProcessError object will have the | |
return code in the returncode attribute. | |
The arguments are the same as for the call function. Example: | |
check_call(["ls", "-l"]) | |
""" | |
retcode = call(*popenargs, **kwargs) | |
if retcode: | |
cmd = kwargs.get("args") | |
if cmd is None: | |
cmd = popenargs[0] | |
> raise CalledProcessError(retcode, cmd) | |
E subprocess.CalledProcessError: Command '['which', 'prelude']' returned non-zero exit status 1. | |
../../miniconda3/lib/python3.8/subprocess.py:364: CalledProcessError | |
_________________________________________________________________________________________________________ ERROR at setup of TestCore.test_non_default_mask[0] _________________________________________________________________________________________________________ | |
@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.prelude)]) | |
def test_prelude_installation(): | |
# note that subprocess.check_call() returns 0 on success, so it must be | |
# negated for the assertion. | |
> assert not subprocess.check_call(['which', 'prelude']) | |
conftest.py:40: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
popenargs = (['which', 'prelude'],), kwargs = {}, retcode = 1, cmd = ['which', 'prelude'] | |
def check_call(*popenargs, **kwargs): | |
"""Run command with arguments. Wait for command to complete. If | |
the exit code was zero then return, otherwise raise | |
CalledProcessError. The CalledProcessError object will have the | |
return code in the returncode attribute. | |
The arguments are the same as for the call function. Example: | |
check_call(["ls", "-l"]) | |
""" | |
retcode = call(*popenargs, **kwargs) | |
if retcode: | |
cmd = kwargs.get("args") | |
if cmd is None: | |
cmd = popenargs[0] | |
> raise CalledProcessError(retcode, cmd) | |
E subprocess.CalledProcessError: Command '['which', 'prelude']' returned non-zero exit status 1. | |
../../miniconda3/lib/python3.8/subprocess.py:364: CalledProcessError | |
_________________________________________________________________________________________________________ ERROR at setup of TestCore.test_wrong_size_mask[0] __________________________________________________________________________________________________________ | |
@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.prelude)]) | |
def test_prelude_installation(): | |
# note that subprocess.check_call() returns 0 on success, so it must be | |
# negated for the assertion. | |
> assert not subprocess.check_call(['which', 'prelude']) | |
conftest.py:40: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
popenargs = (['which', 'prelude'],), kwargs = {}, retcode = 1, cmd = ['which', 'prelude'] | |
def check_call(*popenargs, **kwargs): | |
"""Run command with arguments. Wait for command to complete. If | |
the exit code was zero then return, otherwise raise | |
CalledProcessError. The CalledProcessError object will have the | |
return code in the returncode attribute. | |
The arguments are the same as for the call function. Example: | |
check_call(["ls", "-l"]) | |
""" | |
retcode = call(*popenargs, **kwargs) | |
if retcode: | |
cmd = kwargs.get("args") | |
if cmd is None: | |
cmd = popenargs[0] | |
> raise CalledProcessError(retcode, cmd) | |
E subprocess.CalledProcessError: Command '['which', 'prelude']' returned non-zero exit status 1. | |
../../miniconda3/lib/python3.8/subprocess.py:364: CalledProcessError | |
______________________________________________________________________________________________________ ERROR at setup of TestCore.test_wrong_phase_dimensions[0] ______________________________________________________________________________________________________ | |
@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.prelude)]) | |
def test_prelude_installation(): | |
# note that subprocess.check_call() returns 0 on success, so it must be | |
# negated for the assertion. | |
> assert not subprocess.check_call(['which', 'prelude']) | |
conftest.py:40: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
popenargs = (['which', 'prelude'],), kwargs = {}, retcode = 1, cmd = ['which', 'prelude'] | |
def check_call(*popenargs, **kwargs): | |
"""Run command with arguments. Wait for command to complete. If | |
the exit code was zero then return, otherwise raise | |
CalledProcessError. The CalledProcessError object will have the | |
return code in the returncode attribute. | |
The arguments are the same as for the call function. Example: | |
check_call(["ls", "-l"]) | |
""" | |
retcode = call(*popenargs, **kwargs) | |
if retcode: | |
cmd = kwargs.get("args") | |
if cmd is None: | |
cmd = popenargs[0] | |
> raise CalledProcessError(retcode, cmd) | |
E subprocess.CalledProcessError: Command '['which', 'prelude']' returned non-zero exit status 1. | |
../../miniconda3/lib/python3.8/subprocess.py:364: CalledProcessError | |
_______________________________________________________________________________________________________ ERROR at setup of TestCore.test_wrong_mag_dimensions[0] _______________________________________________________________________________________________________ | |
@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.prelude)]) | |
def test_prelude_installation(): | |
# note that subprocess.check_call() returns 0 on success, so it must be | |
# negated for the assertion. | |
> assert not subprocess.check_call(['which', 'prelude']) | |
conftest.py:40: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
popenargs = (['which', 'prelude'],), kwargs = {}, retcode = 1, cmd = ['which', 'prelude'] | |
def check_call(*popenargs, **kwargs): | |
"""Run command with arguments. Wait for command to complete. If | |
the exit code was zero then return, otherwise raise | |
CalledProcessError. The CalledProcessError object will have the | |
return code in the returncode attribute. | |
The arguments are the same as for the call function. Example: | |
check_call(["ls", "-l"]) | |
""" | |
retcode = call(*popenargs, **kwargs) | |
if retcode: | |
cmd = kwargs.get("args") | |
if cmd is None: | |
cmd = popenargs[0] | |
> raise CalledProcessError(retcode, cmd) | |
E subprocess.CalledProcessError: Command '['which', 'prelude']' returned non-zero exit status 1. | |
../../miniconda3/lib/python3.8/subprocess.py:364: CalledProcessError | |
__________________________________________________________________________________________________ ERROR at setup of TestCore.test_wrong_mag_and_phase_dimensions[0] __________________________________________________________________________________________________ | |
@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.prelude)]) | |
def test_prelude_installation(): | |
# note that subprocess.check_call() returns 0 on success, so it must be | |
# negated for the assertion. | |
> assert not subprocess.check_call(['which', 'prelude']) | |
conftest.py:40: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
popenargs = (['which', 'prelude'],), kwargs = {}, retcode = 1, cmd = ['which', 'prelude'] | |
def check_call(*popenargs, **kwargs): | |
"""Run command with arguments. Wait for command to complete. If | |
the exit code was zero then return, otherwise raise | |
CalledProcessError. The CalledProcessError object will have the | |
return code in the returncode attribute. | |
The arguments are the same as for the call function. Example: | |
check_call(["ls", "-l"]) | |
""" | |
retcode = call(*popenargs, **kwargs) | |
if retcode: | |
cmd = kwargs.get("args") | |
if cmd is None: | |
cmd = popenargs[0] | |
> raise CalledProcessError(retcode, cmd) | |
E subprocess.CalledProcessError: Command '['which', 'prelude']' returned non-zero exit status 1. | |
../../miniconda3/lib/python3.8/subprocess.py:364: CalledProcessError | |
_____________________________________________________________________________________________________________ ERROR at setup of TestCore.test_phase_2d[0] _____________________________________________________________________________________________________________ | |
@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.prelude)]) | |
def test_prelude_installation(): | |
# note that subprocess.check_call() returns 0 on success, so it must be | |
# negated for the assertion. | |
> assert not subprocess.check_call(['which', 'prelude']) | |
conftest.py:40: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
popenargs = (['which', 'prelude'],), kwargs = {}, retcode = 1, cmd = ['which', 'prelude'] | |
def check_call(*popenargs, **kwargs): | |
"""Run command with arguments. Wait for command to complete. If | |
the exit code was zero then return, otherwise raise | |
CalledProcessError. The CalledProcessError object will have the | |
return code in the returncode attribute. | |
The arguments are the same as for the call function. Example: | |
check_call(["ls", "-l"]) | |
""" | |
retcode = call(*popenargs, **kwargs) | |
if retcode: | |
cmd = kwargs.get("args") | |
if cmd is None: | |
cmd = popenargs[0] | |
> raise CalledProcessError(retcode, cmd) | |
E subprocess.CalledProcessError: Command '['which', 'prelude']' returned non-zero exit status 1. | |
../../miniconda3/lib/python3.8/subprocess.py:364: CalledProcessError | |
____________________________________________________________________________________________________________ ERROR at setup of TestCore.test_threshold[0] _____________________________________________________________________________________________________________ | |
@pytest.fixture(params=[pytest.param(0, marks=pytest.mark.prelude)]) | |
def test_prelude_installation(): | |
# note that subprocess.check_call() returns 0 on success, so it must be | |
# negated for the assertion. | |
> assert not subprocess.check_call(['which', 'prelude']) | |
conftest.py:40: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
popenargs = (['which', 'prelude'],), kwargs = {}, retcode = 1, cmd = ['which', 'prelude'] | |
def check_call(*popenargs, **kwargs): | |
"""Run command with arguments. Wait for command to complete. If | |
the exit code was zero then return, otherwise raise | |
CalledProcessError. The CalledProcessError object will have the | |
return code in the returncode attribute. | |
The arguments are the same as for the call function. Example: | |
check_call(["ls", "-l"]) | |
""" | |
retcode = call(*popenargs, **kwargs) | |
if retcode: | |
cmd = kwargs.get("args") | |
if cmd is None: | |
cmd = popenargs[0] | |
> raise CalledProcessError(retcode, cmd) | |
E subprocess.CalledProcessError: Command '['which', 'prelude']' returned non-zero exit status 1. | |
../../miniconda3/lib/python3.8/subprocess.py:364: CalledProcessError | |
============================================================================================================================== FAILURES =============================================================================================================================== | |
______________________________________________________________________________________________________________ TestCore.test_demo_script_outputs_figure _______________________________________________________________________________________________________________ | |
self = <test_example_scripts.TestCore object at 0x7f899d1a8700> | |
def test_demo_script_outputs_figure(self): | |
> fname_nifti = general_demo(self.tmp_path) | |
test/test_example_scripts.py:28: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
examples/general_demo.py:72: in general_demo | |
unwrapped_phase_e1 = prelude(phase_e1, nii_mag_e1.get_fdata(), nii_phase_e1.affine) | |
shimmingtoolbox/unwrap/prelude.py:79: in prelude | |
run_subprocess(unwrap_command) | |
shimmingtoolbox/utils.py:20: in run_subprocess | |
subprocess.run(cmd.split(' '), stdout=subprocess.PIPE, text=True, check=True) | |
../../miniconda3/lib/python3.8/subprocess.py:489: in run | |
with Popen(*popenargs, **kwargs) as process: | |
../../miniconda3/lib/python3.8/subprocess.py:854: in __init__ | |
self._execute_child(args, executable, preexec_fn, close_fds, | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <subprocess.Popen object at 0x7f899c7c9e20>, args = ['prelude', '-p', '/var/folders/11/q0s99tk17rj_7jtmj1psydbr0000gn/T/st_preludemr63v_hc/rawPhase', '-a', '/var/folders/11/q0s99tk17rj_7jtmj1psydbr0000gn/T/st_preludemr63v_hc/mag', '-o', ...] | |
executable = b'prelude', preexec_fn = None, close_fds = True, pass_fds = (), cwd = None, env = None, startupinfo = None, creationflags = 0, shell = False, p2cread = -1, p2cwrite = -1, c2pread = 14, c2pwrite = 15, errread = -1, errwrite = -1 | |
restore_signals = True, start_new_session = False | |
def _execute_child(self, args, executable, preexec_fn, close_fds, | |
pass_fds, cwd, env, | |
startupinfo, creationflags, shell, | |
p2cread, p2cwrite, | |
c2pread, c2pwrite, | |
errread, errwrite, | |
restore_signals, start_new_session): | |
"""Execute program (POSIX version)""" | |
if isinstance(args, (str, bytes)): | |
args = [args] | |
elif isinstance(args, os.PathLike): | |
if shell: | |
raise TypeError('path-like args is not allowed when ' | |
'shell is true') | |
args = [args] | |
else: | |
args = list(args) | |
if shell: | |
# On Android the default shell is at '/system/bin/sh'. | |
unix_shell = ('/system/bin/sh' if | |
hasattr(sys, 'getandroidapilevel') else '/bin/sh') | |
args = [unix_shell, "-c"] + args | |
if executable: | |
args[0] = executable | |
if executable is None: | |
executable = args[0] | |
sys.audit("subprocess.Popen", executable, args, cwd, env) | |
if (_USE_POSIX_SPAWN | |
and os.path.dirname(executable) | |
and preexec_fn is None | |
and not close_fds | |
and not pass_fds | |
and cwd is None | |
and (p2cread == -1 or p2cread > 2) | |
and (c2pwrite == -1 or c2pwrite > 2) | |
and (errwrite == -1 or errwrite > 2) | |
and not start_new_session): | |
self._posix_spawn(args, executable, env, restore_signals, | |
p2cread, p2cwrite, | |
c2pread, c2pwrite, | |
errread, errwrite) | |
return | |
orig_executable = executable | |
# For transferring possible exec failure from child to parent. | |
# Data format: "exception name:hex errno:description" | |
# Pickle is not used; it is complex and involves memory allocation. | |
errpipe_read, errpipe_write = os.pipe() | |
# errpipe_write must not be in the standard io 0, 1, or 2 fd range. | |
low_fds_to_close = [] | |
while errpipe_write < 3: | |
low_fds_to_close.append(errpipe_write) | |
errpipe_write = os.dup(errpipe_write) | |
for low_fd in low_fds_to_close: | |
os.close(low_fd) | |
try: | |
try: | |
# We must avoid complex work that could involve | |
# malloc or free in the child process to avoid | |
# potential deadlocks, thus we do all this here. | |
# and pass it to fork_exec() | |
if env is not None: | |
env_list = [] | |
for k, v in env.items(): | |
k = os.fsencode(k) | |
if b'=' in k: | |
raise ValueError("illegal environment variable name") | |
env_list.append(k + b'=' + os.fsencode(v)) | |
else: | |
env_list = None # Use execv instead of execve. | |
executable = os.fsencode(executable) | |
if os.path.dirname(executable): | |
executable_list = (executable,) | |
else: | |
# This matches the behavior of os._execvpe(). | |
executable_list = tuple( | |
os.path.join(os.fsencode(dir), executable) | |
for dir in os.get_exec_path(env)) | |
fds_to_keep = set(pass_fds) | |
fds_to_keep.add(errpipe_write) | |
self.pid = _posixsubprocess.fork_exec( | |
args, executable_list, | |
close_fds, tuple(sorted(map(int, fds_to_keep))), | |
cwd, env_list, | |
p2cread, p2cwrite, c2pread, c2pwrite, | |
errread, errwrite, | |
errpipe_read, errpipe_write, | |
restore_signals, start_new_session, preexec_fn) | |
self._child_created = True | |
finally: | |
# be sure the FD is closed no matter what | |
os.close(errpipe_write) | |
self._close_pipe_fds(p2cread, p2cwrite, | |
c2pread, c2pwrite, | |
errread, errwrite) | |
# Wait for exec to fail or succeed; possibly raising an | |
# exception (limited in size) | |
errpipe_data = bytearray() | |
while True: | |
part = os.read(errpipe_read, 50000) | |
errpipe_data += part | |
if not part or len(errpipe_data) > 50000: | |
break | |
finally: | |
# be sure the FD is closed no matter what | |
os.close(errpipe_read) | |
if errpipe_data: | |
try: | |
pid, sts = os.waitpid(self.pid, 0) | |
if pid == self.pid: | |
self._handle_exitstatus(sts) | |
else: | |
self.returncode = sys.maxsize | |
except ChildProcessError: | |
pass | |
try: | |
exception_name, hex_errno, err_msg = ( | |
errpipe_data.split(b':', 2)) | |
# The encoding here should match the encoding | |
# written in by the subprocess implementations | |
# like _posixsubprocess | |
err_msg = err_msg.decode() | |
except ValueError: | |
exception_name = b'SubprocessError' | |
hex_errno = b'0' | |
err_msg = 'Bad exception data from child: {!r}'.format( | |
bytes(errpipe_data)) | |
child_exception_type = getattr( | |
builtins, exception_name.decode('ascii'), | |
SubprocessError) | |
if issubclass(child_exception_type, OSError) and hex_errno: | |
errno_num = int(hex_errno, 16) | |
child_exec_never_called = (err_msg == "noexec") | |
if child_exec_never_called: | |
err_msg = "" | |
# The error must be from chdir(cwd). | |
err_filename = cwd | |
else: | |
err_filename = orig_executable | |
if errno_num != 0: | |
err_msg = os.strerror(errno_num) | |
> raise child_exception_type(errno_num, err_msg, err_filename) | |
E FileNotFoundError: [Errno 2] No such file or directory: 'prelude' | |
../../miniconda3/lib/python3.8/subprocess.py:1702: FileNotFoundError | |
------------------------------------------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------------------------------------------- | |
Example in: | |
/Users/alex/code/shimming-toolbox/test/__tmp__/niftis/tmp_dcm2bids/helper | |
------------------------------------------------------------------------------------------------------------------------ Captured stderr call ------------------------------------------------------------------------------------------------------------------------- | |
Status: 11.4MB [00:01, 7.51MB/s] | |
INFO:dcm2bids.dcm2bids:--- dcm2bids start --- | |
INFO:dcm2bids.dcm2bids:OS:version: macOS-10.15.7-x86_64-i386-64bit | |
INFO:dcm2bids.dcm2bids:python:version: 3.8.3 (default, May 19 2020, 13:54:14) [Clang 10.0.0 ] | |
INFO:dcm2bids.dcm2bids:dcm2bids:version: 2.1.4 | |
INFO:dcm2bids.dcm2bids:dcm2niix:version: v1.0.20201102 | |
INFO:dcm2bids.dcm2bids:participant: sub-01 | |
INFO:dcm2bids.dcm2bids:session: | |
INFO:dcm2bids.dcm2bids:config: /Users/alex/code/shimming-toolbox/config/dcm2bids.json | |
INFO:dcm2bids.dcm2bids:BIDS directory: /Users/alex/code/shimming-toolbox/test/__tmp__/niftis | |
INFO:dcm2bids.utils:Running dcm2niix -b y -ba y -z y -f '%3s_%f_%p_%t' -o /Users/alex/code/shimming-toolbox/test/__tmp__/niftis/tmp_dcm2bids/sub-01 /Users/alex/code/shimming-toolbox/test/__tmp__/testing_data/dicom_unsorted | |
INFO:dcm2bids.dcm2niix:Check log file for dcm2niix output | |
INFO:dcm2bids.sidecar:Sidecars pairing: | |
INFO:dcm2bids.sidecar:_magnitude1 <- 006_dicom_unsorted_a_gre_DYNshim_20191101153345_e1 | |
INFO:dcm2bids.sidecar:_phase1 <- 007_dicom_unsorted_a_gre_DYNshim_20191101153345_e1_ph | |
INFO:dcm2bids.sidecar:_magnitude2 <- 006_dicom_unsorted_a_gre_DYNshim_20191101153345_e2 | |
INFO:dcm2bids.sidecar:_magnitude3 <- 006_dicom_unsorted_a_gre_DYNshim_20191101153345_e3 | |
INFO:dcm2bids.sidecar:_magnitude5 <- 006_dicom_unsorted_a_gre_DYNshim_20191101153345_e5 | |
INFO:dcm2bids.sidecar:_phase2 <- 007_dicom_unsorted_a_gre_DYNshim_20191101153345_e2_ph | |
INFO:dcm2bids.sidecar:_phase3 <- 007_dicom_unsorted_a_gre_DYNshim_20191101153345_e3_ph | |
INFO:dcm2bids.sidecar:_magnitude4 <- 006_dicom_unsorted_a_gre_DYNshim_20191101153345_e4 | |
INFO:dcm2bids.sidecar:_magnitude6 <- 006_dicom_unsorted_a_gre_DYNshim_20191101153345_e6 | |
INFO:dcm2bids.sidecar:_phase4 <- 007_dicom_unsorted_a_gre_DYNshim_20191101153345_e4_ph | |
INFO:dcm2bids.sidecar:_phase5 <- 007_dicom_unsorted_a_gre_DYNshim_20191101153345_e5_ph | |
INFO:dcm2bids.sidecar:_phase6 <- 007_dicom_unsorted_a_gre_DYNshim_20191101153345_e6_ph | |
INFO:dcm2bids.dcm2bids:moving acquisitions into BIDS folder | |
INFO:root:Unwrap with prelude | |
-------------------------------------------------------------------------------------------------------------------------- Captured log call -------------------------------------------------------------------------------------------------------------------------- | |
INFO root:prelude.py:78 Unwrap with prelude | |
______________________________________________________________________________________________________________ TestCore.test_load_nifti_multiple_echoes _______________________________________________________________________________________________________________ | |
self = <test_load_nifti.TestCore object at 0x7f899d04b8e0>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f899d075250> | |
def test_load_nifti_multiple_echoes(self, monkeypatch): | |
""" | |
Assert passes with correct data for multiple echoes | |
:return: | |
""" | |
if self.tmp_path.exists(): | |
shutil.rmtree(self.data_path_volume) | |
monkeypatch.setattr('sys.stdin', StringIO('0\n')) | |
niftis, info, json_info = load_nifti(self.tmp_path) | |
assert (len(info) == 2), "Wrong number od info data 1" | |
assert (len(json_info) == 2), "Wrong number of JSON data 1" | |
self._json_phase['EchoNumber'] = 2 | |
> assert (json.dumps(json_info[0], sort_keys=True) == json.dumps(self._json_phase, sort_keys=True)), \ | |
"JSON file is not correctly loaded for first JSON1" | |
E AssertionError: JSON file is not correctly loaded for first JSON1 | |
E assert '{"Acquisitio...mp": 222.944}' == '{"Acquisition...mp": 222.944}' | |
E Skipping 357 identical leading characters in diff, use -v to show | |
E Skipping 1213 identical trailing characters in diff, use -v to show | |
E - oNumber": 1, "EchoTi | |
E ? ^ | |
E + oNumber": 2, "EchoTi | |
E ? ^ | |
test/test_load_nifti.py:267: AssertionError | |
------------------------------------------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------------------------------------------- | |
0:test_data | |
1:test_data_2 | |
Enter the number for the appropriate acquisition folder, (type 'q' to quit) : | |
------------------------------------------------------------------------------------------------------------------------ Captured stderr call ------------------------------------------------------------------------------------------------------------------------- | |
INFO:root:Multiple acquisition directories in path. Choosing only one. | |
INFO:root:Reading acquisitions for run 1 | |
-------------------------------------------------------------------------------------------------------------------------- Captured log call -------------------------------------------------------------------------------------------------------------------------- | |
INFO root:load_nifti.py:66 Multiple acquisition directories in path. Choosing only one. | |
INFO root:load_nifti.py:128 Reading acquisitions for run 1 | |
============================================================================================================ 2 failed, 52 passed, 8 error in 15.40 seconds ============================================================================================================ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment