1
1
import json
2
+ import itertools
2
3
from pydra2app .core .cli import make
3
4
from pydra2app .xnat import XnatApp
4
5
from frametree .core .utils import show_cli_trace
@@ -23,20 +24,27 @@ def test_bids_app(
23
24
else :
24
25
build_arg = "--build"
25
26
27
+ licenses = [["--license" , p .stem , str (p )] for p in license_src .glob ("*" )]
28
+
26
29
result = cli_runner (
27
30
make ,
28
- [
29
- str (bp .spec_path ),
30
- "pipelines-core-test" ,
31
- "--build-dir" ,
32
- str (build_dir ),
33
- build_arg ,
34
- "--for-localhost" ,
35
- "--use-local-packages" ,
36
- "--raise-errors" ,
37
- "--license-src" ,
38
- str (license_src ),
39
- ],
31
+ list (
32
+ itertools .chain (
33
+ [
34
+ "xnat" ,
35
+ str (bp .spec_path ),
36
+ "--registry" ,
37
+ "pipelines-core-test" ,
38
+ "--build-dir" ,
39
+ str (build_dir ),
40
+ build_arg ,
41
+ "--for-localhost" ,
42
+ "--use-local-packages" ,
43
+ "--raise-errors" ,
44
+ ],
45
+ * licenses ,
46
+ )
47
+ )
40
48
)
41
49
42
50
assert result .exit_code == 0 , show_cli_trace (result )
@@ -45,36 +53,38 @@ def test_bids_app(
45
53
46
54
with xnat_connect () as xlogin :
47
55
56
+ build_name = image_spec .name .split ("." )[- 1 ]
57
+
48
58
with open (
49
- build_dir / image_spec . name / "xnat_commands" / (image_spec . name + ".json" )
59
+ build_dir / "xnat_commands" / (build_name + ".json" )
50
60
) as f :
51
61
xnat_command = json .load (f )
52
- xnat_command . name = xnat_command . label = image_spec .name + run_prefix
62
+ xnat_command [ ' name' ] = xnat_command [ ' label' ] = image_spec .name + run_prefix
53
63
54
64
test_xsession = next (iter (xlogin .projects [bp .project_id ].experiments .values ()))
55
65
56
66
inputs_json = {}
57
67
58
- for inpt in image_spec .command .inputs :
59
- if (bids_app_blueprint .test_data / inpt . name ).exists ():
68
+ for inpt in image_spec .command () .inputs :
69
+ if (bids_app_blueprint .test_data / inpt ).exists ():
60
70
converter_args_path = (
61
- bids_app_blueprint .test_data / inpt . name / "converter.json"
71
+ bids_app_blueprint .test_data / inpt / "converter.json"
62
72
)
63
73
converter_args = ""
64
74
if converter_args_path .exists ():
65
75
with open (converter_args_path ) as f :
66
76
dct = json .load (f )
67
77
for name , val in dct .items ():
68
78
converter_args += f" converter.{ name } ={ val } "
69
- inputs_json [inpt . name ] = inpt . name + converter_args
79
+ inputs_json [inpt ] = inpt + converter_args
70
80
else :
71
- inputs_json [inpt . name ] = ""
81
+ inputs_json [inpt ] = ""
72
82
73
83
for pname , pval in bp .parameters .items ():
74
84
inputs_json [pname ] = pval
75
85
76
- inputs_json ["Arcana_flags " ] = (
77
- "--worker serial "
86
+ inputs_json ["pydra_flags " ] = (
87
+ "--worker debug "
78
88
"--work /work " # NB: work dir moved inside container due to file-locking issue on some mounted volumes (see https://github.com/tox-dev/py-filelock/issues/147)
79
89
"--dataset-name default "
80
90
"--loglevel debug "
0 commit comments