File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
tests/test_optional/test_kaleido Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -293,3 +293,29 @@ def test_fig_to_image():
293293 mock_calc_fig .assert_called_once ()
294294 args , _ = mock_calc_fig .call_args
295295 assert args [0 ] == test_fig .to_dict ()
296+
297+
298+ def test_get_chrome ():
299+ """Test that plotly.io.get_chrome() can be called."""
300+
301+ with patch (
302+ "plotly.io._kaleido.kaleido.get_chrome_sync" ,
303+ return_value = "/mock/path/to/chrome" ,
304+ ) as mock_get_chrome :
305+ with patch ("builtins.input" , return_value = "y" ): # Mock user confirmation
306+ with patch (
307+ "sys.argv" , ["plotly_get_chrome" , "-y" ]
308+ ): # Mock CLI args to skip confirmation
309+ if not kaleido_available () or kaleido_major () < 1 :
310+ # Test that ValueError is raised when Kaleido requirements aren't met
311+ with pytest .raises (
312+ ValueError ,
313+ match = "This command requires Kaleido v1.0.0 or greater" ,
314+ ):
315+ pio .get_chrome ()
316+ else :
317+ # Test normal operation when Kaleido v1+ is available
318+ pio .get_chrome ()
319+
320+ # Verify that kaleido.get_chrome_sync was called
321+ mock_get_chrome .assert_called_once ()
You can’t perform that action at this time.
0 commit comments