@@ -949,30 +949,55 @@ class TestLookupOptions(ComparisonTestCase):
949949 def test_lookup_options_honors_backend (self ):
950950 points = Points ([[1 , 2 ], [3 , 4 ]])
951951
952+ try :
953+ import holoviews .plotting .matplotlib # noqa
954+ except :
955+ pass
956+
957+ try :
958+ import holoviews .plotting .bokeh # noqa
959+ except :
960+ pass
961+
962+ try :
963+ import holoviews .plotting .plotly # noqa
964+ except :
965+ pass
966+
967+ backends = Store .loaded_backends ()
968+
952969 # Lookup points style options with matplotlib and plotly backends while current
953970 # backend is bokeh
954- Store .current_backend = 'bokeh'
955- options_matplotlib = Store .lookup_options ("matplotlib" , points , "style" )
956- options_plotly = Store .lookup_options ("plotly" , points , "style" )
971+ if 'bokeh' in backends :
972+ Store .set_current_backend ('bokeh' )
973+ if 'matplotlib' in backends :
974+ options_matplotlib = Store .lookup_options ("matplotlib" , points , "style" )
975+ if 'plotly' in backends :
976+ options_plotly = Store .lookup_options ("plotly" , points , "style" )
957977
958978 # Lookup points style options with bokeh backend while current
959979 # backend is matplotlib
960- Store .current_backend = 'matplotlib'
961- options_bokeh = Store .lookup_options ("bokeh" , points , "style" )
980+ if 'matplotlib' in backends :
981+ Store .set_current_backend ('matplotlib' )
982+ if 'bokeh' in backends :
983+ options_bokeh = Store .lookup_options ("bokeh" , points , "style" )
962984
963985 # Check matplotlib style options
964- for opt in ["cmap" , "color" , "marker" ]:
965- self .assertIn (opt , options_matplotlib .keys ())
966- self .assertNotIn ("muted_alpha" , options_matplotlib .keys ())
986+ if 'matplotlib' in backends :
987+ for opt in ["cmap" , "color" , "marker" ]:
988+ self .assertIn (opt , options_matplotlib .keys ())
989+ self .assertNotIn ("muted_alpha" , options_matplotlib .keys ())
967990
968991 # Check bokeh style options
969- for opt in ["cmap" , "color" , "muted_alpha" , "size" ]:
970- self .assertIn (opt , options_bokeh .keys ())
992+ if 'bokeh' in backends :
993+ for opt in ["cmap" , "color" , "muted_alpha" , "size" ]:
994+ self .assertIn (opt , options_bokeh .keys ())
971995
972996 # Check plotly style options
973- for opt in ["color" ]:
974- self .assertIn (opt , options_plotly .keys ())
975- self .assertNotIn ("muted_alpha" , options_matplotlib .keys ())
997+ if 'plotly' in backends :
998+ for opt in ["color" ]:
999+ self .assertIn (opt , options_plotly .keys ())
1000+ self .assertNotIn ("muted_alpha" , options_matplotlib .keys ())
9761001
9771002
9781003class TestCrossBackendOptionSpecification (ComparisonTestCase ):
0 commit comments