File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1717
1818"""Pytest configuration file."""
1919
20+ import webbrowser
21+
2022import matplotlib
2123
2224#
@@ -37,3 +39,12 @@ def no_plot_window(monkeypatch):
3739 monkeypatch .setattr (plt , "show" , lambda : None )
3840 yield
3941 plt .close ("all" )
42+
43+
44+ @pytest .fixture
45+ def no_browser (monkeypatch ):
46+ """Fixture to prevent webbrowser from opening during tests."""
47+ monkeypatch .setattr (webbrowser , "open" , lambda x : None )
48+ monkeypatch .setattr (webbrowser , "open_new" , lambda x : None )
49+ monkeypatch .setattr (webbrowser , "open_new_tab" , lambda x : None )
50+ yield
Original file line number Diff line number Diff line change 2222from pysits .sits .ml import sits_rfor , sits_train
2323from pysits .sits .ts import sits_patterns , sits_som_map
2424from pysits .sits .utils import r_package_dir
25- from pysits .sits .visualization import sits_plot
25+ from pysits .sits .visualization import sits_plot , sits_view
2626
2727
2828def test_sits_visualization (no_plot_window ):
@@ -87,3 +87,21 @@ def test_classified_cube_visualization(no_plot_window):
8787
8888 # Plot the result
8989 sits_plot (cube )
90+
91+
92+ def test_sits_visualization_leaflet (no_browser ):
93+ """Test sits visualization."""
94+ sits_view (samples_l8_rondonia_2bands )
95+
96+
97+ def test_cube_visualization_leaflet (no_browser ):
98+ """Test cube visualization."""
99+ # Create a cube
100+ cube = sits_cube (
101+ source = "BDC" ,
102+ collection = "MOD13Q1-6.1" ,
103+ data_dir = r_package_dir ("extdata/raster/mod13q1" , package = "sits" ),
104+ )
105+
106+ # Plot the cube
107+ sits_view (cube )
You can’t perform that action at this time.
0 commit comments