Skip to content

Commit b7d8422

Browse files
committed
Don't test orjson engine when orjson not installed
1 parent d44ec26 commit b7d8422

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/python/plotly/plotly/tests/test_io/test_to_from_plotly_json.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
import pytest
12
import plotly.io.json as pio
23
import plotly.graph_objects as go
34
import numpy as np
45
import pandas as pd
5-
import pytest
66
import json
77
import datetime
88
import sys
99
from pytz import timezone
10+
from _plotly_utils.optional_imports import get_module
11+
12+
orjson = get_module("orjson")
1013

1114
eastern = timezone("US/Eastern")
1215

@@ -61,6 +64,12 @@ def check_roundtrip(value, engine, pretty):
6164

6265

6366
# Fixtures
67+
if orjson is not None:
68+
engines = ["json", "orjson", "legacy", "auto"]
69+
else:
70+
engines = ["json", "legacy", "auto"]
71+
72+
6473
@pytest.fixture(scope="module", params=["json", "orjson", "legacy", "auto"])
6574
def engine(request):
6675
return request.param

0 commit comments

Comments
 (0)