@@ -31,7 +31,8 @@ def test_can_run_with_custom_values(self, mock_ex, mock_sleep, mock_submit):
31
31
mock_ex .side_effect = [[None , 0 ], [mock_executions [0 ], 40 ], [mock_executions [1 ], 20 ]]
32
32
io = Mock ()
33
33
executions = list (_run (
34
- "main.nf" , run_path = "/exdir" , output_path = "/out" , log_path = "/log" , resume = "a_b" , version = "21.10" , configs = ["conf1" ],
34
+ "main.nf" , run_path = "/exdir" , output_path = "/out" , log_path = "/log" , resume = "a_b" ,
35
+ version = "21.10" , java_home = "/java" , configs = ["conf1" ],
35
36
params = {"param" : "2" }, profiles = ["docker" ], timezone = "UTC" , report = "report.html" ,
36
37
timeline = "time.html" , dag = "dag.html" , trace = "trace.html" , sleep = 4 , io = io
37
38
))
@@ -77,14 +78,13 @@ def test_can_run_with_poll(self, mock_run):
77
78
78
79
class SubmitTests (TestCase ):
79
80
80
-
81
81
@patch ("os.path.abspath" )
82
82
@patch ("nextflow.command.make_nextflow_command" )
83
83
@patch ("subprocess.Popen" )
84
84
def test_can_submit_with_default_values (self , mock_run , mock_nc , mock_abs ):
85
85
mock_abs .side_effect = ["/run" , "/out" , "/log" ]
86
86
submission = submit_execution ("main.nf" )
87
- mock_nc .assert_called_with ("/run" , "/run" , "/run" , "main.nf" , False , None , None , None , None , None , None , None , None , None , None )
87
+ mock_nc .assert_called_with ("/run" , "/run" , "/run" , "main.nf" , False , None , None , None , None , None , None , None , None , None , None , None )
88
88
mock_abs .assert_called_once_with ("." )
89
89
mock_run .assert_called_with (
90
90
mock_nc .return_value ,
@@ -106,10 +106,10 @@ def test_can_submit_with_custom_values(self, mock_wait, mock_run, mock_nc):
106
106
io = Mock ()
107
107
submission = submit_execution (
108
108
"main.nf" , run_path = "/exdir" , output_path = "/out" , log_path = "/log" , resume = "a_b" , version = "21.10" , configs = ["conf1" ],
109
- params = {"param" : "2" }, profiles = ["docker" ], timezone = "UTC" , report = "report.html" ,
109
+ params = {"param" : "2" }, profiles = ["docker" ], timezone = "UTC" , report = "report.html" , java_home = "/java" ,
110
110
timeline = "time.html" , dag = "dag.html" , trace = "trace.html" , io = io
111
111
)
112
- mock_nc .assert_called_with ("/exdir" , "/out" , "/log" , "main.nf" , "a_b" , "21.10" , ["conf1" ], {"param" : "2" }, ["docker" ], "UTC" , "report.html" , "time.html" , "dag.html" , "trace.html" , io )
112
+ mock_nc .assert_called_with ("/exdir" , "/out" , "/log" , "main.nf" , "a_b" , "21.10" , "/java" , ["conf1" ], {"param" : "2" }, ["docker" ], "UTC" , "report.html" , "time.html" , "dag.html" , "trace.html" , io )
113
113
mock_run .assert_called_with (
114
114
mock_nc .return_value ,
115
115
universal_newlines = True , shell = True
@@ -128,7 +128,7 @@ def test_can_submit_with_custom_values(self, mock_wait, mock_run, mock_nc):
128
128
def test_can_submit_with_custom_io (self , mock_run , mock_nc ):
129
129
io = Mock ()
130
130
submission = submit_execution ("main.nf" , io = io )
131
- mock_nc .assert_called_with (io .abspath .return_value , io .abspath .return_value , io .abspath .return_value , "main.nf" , False , None , None , None , None , None , None , None , None , None , io )
131
+ mock_nc .assert_called_with (io .abspath .return_value , io .abspath .return_value , io .abspath .return_value , "main.nf" , False , None , None , None , None , None , None , None , None , None , None , io )
132
132
io .abspath .assert_called_once_with ("." )
133
133
mock_run .assert_called_with (
134
134
mock_nc .return_value ,
@@ -146,7 +146,7 @@ def test_can_submit_with_custom_io(self, mock_run, mock_nc):
146
146
def test_can_run_with_custom_runner (self , mock_nc ):
147
147
runner = MagicMock ()
148
148
submission = submit_execution ("main.nf" , runner = runner )
149
- mock_nc .assert_called_with (os .path .abspath ("." ), os .path .abspath ("." ), os .path .abspath ("." ), "main.nf" , False , None , None , None , None , None , None , None , None , None , None )
149
+ mock_nc .assert_called_with (os .path .abspath ("." ), os .path .abspath ("." ), os .path .abspath ("." ), "main.nf" , False , None , None , None , None , None , None , None , None , None , None , None )
150
150
runner .assert_called_with (mock_nc .return_value )
151
151
self .assertEqual (submission .pipeline_path , "main.nf" )
152
152
self .assertEqual (submission .run_path , os .path .abspath ("." ))
@@ -175,8 +175,8 @@ def test_can_get_full_nextflow_command(self, mock_report, mock_prof, mock_params
175
175
mock_prof .return_value = "-profile docker,test"
176
176
mock_report .return_value = "--dag.html"
177
177
io = Mock ()
178
- command = make_nextflow_command ("/exdir" , "/out" , "/log" , "main.nf" , True , "21.10" , ["conf1" ], {"param" : "2" }, ["docker" ], "UTC" , "report.html" , "time.html" , "dag.html" , "trace.html" , io )
179
- mock_env .assert_called_with ("21.10" , "UTC" , "/out" , "/exdir" )
178
+ command = make_nextflow_command ("/exdir" , "/out" , "/log" , "main.nf" , True , "21.10" , "/java" , ["conf1" ], {"param" : "2" }, ["docker" ], "UTC" , "report.html" , "time.html" , "dag.html" , "trace.html" , io )
179
+ mock_env .assert_called_with ("21.10" , "UTC" , "/out" , "/exdir" , "/java" )
180
180
mock_conf .assert_called_with (["conf1" ])
181
181
mock_params .assert_called_with ({"param" : "2" })
182
182
mock_prof .assert_called_with (["docker" ])
@@ -201,8 +201,8 @@ def test_can_get_minimal_nextflow_command(self, mock_abspath, mock_report, mock_
201
201
mock_prof .return_value = ""
202
202
mock_report .return_value = ""
203
203
mock_abspath .return_value = "/exdir"
204
- command = make_nextflow_command ("/exdir" , "/exdir" , "/exdir" , "main.nf" , False , "21.10" , ["conf1" ], {"param" : "2" }, ["docker" ], None , None , None , None , None , None )
205
- mock_env .assert_called_with ("21.10" , None , "/exdir" , "/exdir" )
204
+ command = make_nextflow_command ("/exdir" , "/exdir" , "/exdir" , "main.nf" , False , "21.10" , "/java" , ["conf1" ], {"param" : "2" }, ["docker" ], None , None , None , None , None , None )
205
+ mock_env .assert_called_with ("21.10" , None , "/exdir" , "/exdir" , "/java" )
206
206
mock_conf .assert_called_with (["conf1" ])
207
207
mock_resume .assert_called_with (False )
208
208
mock_params .assert_called_with ({"param" : "2" })
@@ -228,8 +228,8 @@ def test_can_use_custom_io(self, mock_report, mock_prof, mock_params, mock_resum
228
228
mock_report .return_value = ""
229
229
io = Mock ()
230
230
io .abspath .return_value = "/exdir"
231
- command = make_nextflow_command ("/exdir" , "/exdir" , "/exdir" , "main.nf" , False , "21.10" , ["conf1" ], {"param" : "2" }, ["docker" ], None , None , None , None , None , io )
232
- mock_env .assert_called_with ("21.10" , None , "/exdir" , "/exdir" )
231
+ command = make_nextflow_command ("/exdir" , "/exdir" , "/exdir" , "main.nf" , False , "21.10" , "/java" , ["conf1" ], {"param" : "2" }, ["docker" ], None , None , None , None , None , io )
232
+ mock_env .assert_called_with ("21.10" , None , "/exdir" , "/exdir" , "/java" )
233
233
mock_conf .assert_called_with (["conf1" ])
234
234
mock_resume .assert_called_with (False )
235
235
mock_params .assert_called_with ({"param" : "2" })
@@ -242,19 +242,23 @@ def test_can_use_custom_io(self, mock_report, mock_prof, mock_params, mock_resum
242
242
class EnvStringTests (TestCase ):
243
243
244
244
def test_can_get_env_without_args (self ):
245
- self .assertEqual (make_nextflow_command_env_string (None , None , "/out" , "/out" ), "NXF_ANSI_LOG=false" )
245
+ self .assertEqual (make_nextflow_command_env_string (None , None , "/out" , "/out" , None ), "NXF_ANSI_LOG=false" )
246
246
247
247
248
248
def test_can_get_env_with_version (self ):
249
- self .assertEqual (make_nextflow_command_env_string ("22.1" , None , "/out" , "/out" ), "NXF_ANSI_LOG=false NXF_VER=22.1" )
249
+ self .assertEqual (make_nextflow_command_env_string ("22.1" , None , "/out" , "/out" , None ), "NXF_ANSI_LOG=false NXF_VER=22.1" )
250
250
251
251
252
252
def test_can_get_env_with_timezone (self ):
253
- self .assertEqual (make_nextflow_command_env_string (None , "UTC" , "/out" , "/out" ), "NXF_ANSI_LOG=false TZ=UTC" )
253
+ self .assertEqual (make_nextflow_command_env_string (None , "UTC" , "/out" , "/out" , None ), "NXF_ANSI_LOG=false TZ=UTC" )
254
254
255
255
256
256
def test_can_get_env_with_work_location (self ):
257
- self .assertEqual (make_nextflow_command_env_string (None , None , "/out" , "/run" ), "NXF_ANSI_LOG=false NXF_WORK=/out/work" )
257
+ self .assertEqual (make_nextflow_command_env_string (None , None , "/out" , "/run" , None ), "NXF_ANSI_LOG=false NXF_WORK=/out/work" )
258
+
259
+
260
+ def test_can_get_env_with_java_home (self ):
261
+ self .assertEqual (make_nextflow_command_env_string (None , None , "/out" , "/out" , "/java" ), "NXF_ANSI_LOG=false JAVA_HOME=/java" )
258
262
259
263
260
264
0 commit comments