Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix test
  • Loading branch information
emilykl committed Jul 16, 2025
commit a0baca39b5788b8a15115b6323e1ef9acbce941c
37 changes: 16 additions & 21 deletions tests/test_optional/test_kaleido/test_kaleido.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,24 +298,19 @@ def test_fig_to_image():
def test_get_chrome():
"""Test that plotly.io.get_chrome() can be called."""

with patch(
"plotly.io._kaleido.kaleido.get_chrome_sync",
return_value="/mock/path/to/chrome",
) as mock_get_chrome:
with patch("builtins.input", return_value="y"): # Mock user confirmation
with patch(
"sys.argv", ["plotly_get_chrome", "-y"]
): # Mock CLI args to skip confirmation
if not kaleido_available() or kaleido_major() < 1:
# Test that ValueError is raised when Kaleido requirements aren't met
with pytest.raises(
ValueError,
match="This command requires Kaleido v1.0.0 or greater",
):
pio.get_chrome()
else:
# Test normal operation when Kaleido v1+ is available
pio.get_chrome()

# Verify that kaleido.get_chrome_sync was called
mock_get_chrome.assert_called_once()
if not kaleido_available() or kaleido_major() < 1:
# Test that ValueError is raised when Kaleido requirements aren't met
with pytest.raises(
ValueError, match="This command requires Kaleido v1.0.0 or greater"
):
pio.get_chrome()
else:
# Test normal operation when Kaleido v1+ is available
with patch(
"plotly.io._kaleido.kaleido.get_chrome_sync",
return_value="/mock/path/to/chrome",
) as mock_get_chrome:
pio.get_chrome()

# Verify that kaleido.get_chrome_sync was called
mock_get_chrome.assert_called_once()