Skip to content

Commit a0baca3

Browse files
committed
fix test
1 parent f667bc4 commit a0baca3

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

tests/test_optional/test_kaleido/test_kaleido.py

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -298,24 +298,19 @@ def test_fig_to_image():
298298
def test_get_chrome():
299299
"""Test that plotly.io.get_chrome() can be called."""
300300

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()
301+
if not kaleido_available() or kaleido_major() < 1:
302+
# Test that ValueError is raised when Kaleido requirements aren't met
303+
with pytest.raises(
304+
ValueError, match="This command requires Kaleido v1.0.0 or greater"
305+
):
306+
pio.get_chrome()
307+
else:
308+
# Test normal operation when Kaleido v1+ is available
309+
with patch(
310+
"plotly.io._kaleido.kaleido.get_chrome_sync",
311+
return_value="/mock/path/to/chrome",
312+
) as mock_get_chrome:
313+
pio.get_chrome()
314+
315+
# Verify that kaleido.get_chrome_sync was called
316+
mock_get_chrome.assert_called_once()

0 commit comments

Comments
 (0)