@@ -57,7 +57,8 @@ def test_backtest_calls_lean_runner_with_correct_algorithm_file() -> None:
5757                                                 ENGINE_IMAGE ,
5858                                                 None ,
5959                                                 False ,
60-                                                  False )
60+                                                  False ,
61+                                                  {})
6162
6263
6364def  test_backtest_calls_lean_runner_with_default_output_directory () ->  None :
@@ -88,7 +89,8 @@ def test_backtest_calls_lean_runner_with_custom_output_directory() -> None:
8889                                                 ENGINE_IMAGE ,
8990                                                 None ,
9091                                                 False ,
91-                                                  False )
92+                                                  False ,
93+                                                  {})
9294
9395
9496def  test_backtest_calls_lean_runner_with_release_mode () ->  None :
@@ -105,7 +107,8 @@ def test_backtest_calls_lean_runner_with_release_mode() -> None:
105107                                                 ENGINE_IMAGE ,
106108                                                 None ,
107109                                                 True ,
108-                                                  False )
110+                                                  False ,
111+                                                  {})
109112
110113
111114def  test_backtest_calls_lean_runner_with_detach () ->  None :
@@ -122,7 +125,8 @@ def test_backtest_calls_lean_runner_with_detach() -> None:
122125                                                 ENGINE_IMAGE ,
123126                                                 None ,
124127                                                 False ,
125-                                                  True )
128+                                                  True ,
129+                                                  {})
126130
127131
128132def  test_backtest_aborts_when_project_does_not_exist () ->  None :
@@ -163,7 +167,8 @@ def test_backtest_forces_update_when_update_option_given() -> None:
163167                                                 ENGINE_IMAGE ,
164168                                                 None ,
165169                                                 False ,
166-                                                  False )
170+                                                  False ,
171+                                                  {})
167172
168173
169174def  test_backtest_passes_custom_image_to_lean_runner_when_set_in_config () ->  None :
@@ -182,7 +187,8 @@ def test_backtest_passes_custom_image_to_lean_runner_when_set_in_config() -> Non
182187                                                 DockerImage (name = "custom/lean" , tag = "123" ),
183188                                                 None ,
184189                                                 False ,
185-                                                  False )
190+                                                  False ,
191+                                                  {})
186192
187193
188194def  test_backtest_passes_custom_image_to_lean_runner_when_given_as_option () ->  None :
@@ -201,7 +207,8 @@ def test_backtest_passes_custom_image_to_lean_runner_when_given_as_option() -> N
201207                                                 DockerImage (name = "custom/lean" , tag = "456" ),
202208                                                 None ,
203209                                                 False ,
204-                                                  False )
210+                                                  False ,
211+                                                  {})
205212
206213
207214@pytest .mark .parametrize ("python_venv" , ["Custom-venv" , 
@@ -289,7 +296,8 @@ def test_backtest_passes_correct_debugging_method_to_lean_runner(value: str, deb
289296                                                 ENGINE_IMAGE ,
290297                                                 debugging_method ,
291298                                                 False ,
292-                                                  False )
299+                                                  False ,
300+                                                  {})
293301
294302
295303def  test_backtest_auto_updates_outdated_python_pycharm_debug_config () ->  None :
@@ -649,3 +657,31 @@ def test_backtest_adds_python_libraries_path_to_lean_config() -> None:
649657    expected_library_path  =  (Path ("/" ) /  library_path .relative_to (lean_cli_root_dir )).as_posix ()
650658
651659    assert  expected_library_path  in  lean_config .get ('python-additional-paths' )
660+ 
661+ 
662+ def  test_backtest_calls_lean_runner_with_extra_docker_config () ->  None :
663+     create_fake_lean_cli_directory ()
664+ 
665+     result  =  CliRunner ().invoke (lean , ["backtest" , "Python Project" ,
666+                                        "--extra-docker-config" ,
667+                                        '{"device_requests": [{"count": -1, "capabilities": [["compute"]]}],' 
668+                                        '"volumes": {"extra/path": {"bind": "/extra/path", "mode": "rw"}}}' ])
669+ 
670+     assert  result .exit_code  ==  0 
671+ 
672+     container .lean_runner .run_lean .assert_called_once_with (mock .ANY ,
673+                                                            "backtesting" ,
674+                                                            Path ("Python Project/main.py" ).resolve (),
675+                                                            mock .ANY ,
676+                                                            ENGINE_IMAGE ,
677+                                                            None ,
678+                                                            False ,
679+                                                            False ,
680+                                                            {
681+                                                                "device_requests" : [
682+                                                                    {"count" : - 1 , "capabilities" : [["compute" ]]}
683+                                                                ],
684+                                                                "volumes" : {
685+                                                                    "extra/path" : {"bind" : "/extra/path" , "mode" : "rw" }
686+                                                                }
687+                                                            })
0 commit comments