Skip to content

Commit

Permalink
TST: Exercise process initializer option
Browse files Browse the repository at this point in the history
  • Loading branch information
mgxd committed Jun 20, 2024
1 parent f2b262e commit 841dcf8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions niworkflows/engine/tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,22 @@ def test_plugin_args_noconfig(workflow, caplog):
)


def test_plugin_app_config(workflow, caplog):
def test_plugin_app_config(workflow, caplog, capsys):
"""Test the plugin works with a nipreps-style configuration."""

def init_print():
print("Custom init")

app_config = SimpleNamespace(
environment=SimpleNamespace(total_memory_gb=1),
_process_initializer=lambda x: None,
_process_initializer=init_print(),
file_path='/does/not/need/to/exist/for/testing',
)
caplog.set_level(logging.CRITICAL, logger="nipype.workflow")
workflow.run(
plugin=MultiProcPlugin(),
plugin_args={"n_procs": 2, "app_config": app_config},
)

captured = capsys.readouterr()
assert "Custom init" in captured.out

0 comments on commit 841dcf8

Please sign in to comment.