22import shutil
33from textwrap import dedent
44
5+ import pytest
56from PyQt6 .QtCore import Qt , QTimer
67from PyQt6 .QtWidgets import QComboBox , QToolButton , QWidget
78from skimage import io
6465 "docs/ert/getting_started/howto/ert_screenshot_adaptive_loc.png" ,
6566]
6667
68+ SKIP_MESSAGE = """Skipping this test because no fonts could be found by qt.
69+
70+ This is a problem on the github runners using ubuntu-latest.
71+ It has been verified that fonts are present in the system by calling fc-list,
72+ but qt are not able to detect these fonts for some reason.
73+ """
74+
6775
6876def run_experiment (qtbot , experiment_mode , gui , click_done = True ):
6977 # Select correct experiment in the simulation panel
@@ -211,7 +219,8 @@ def test_that_poly_new_minimal_screenshots_are_up_to_date(
211219
212220 gui = open_gui_with_docs_example (tmp_path , example_folder , "poly.ert" )
213221
214- assert gui .available_fonts , "No fonts could be found by qt"
222+ if not gui .available_fonts :
223+ pytest .skip (SKIP_MESSAGE )
215224
216225 compare_img_with_gui (gui_changed , example_folder , "ert.png" , gui , qtbot )
217226
@@ -239,7 +248,8 @@ def test_that_poly_new_with_simple_script_screenshots_are_up_to_date(
239248
240249 gui = open_gui_with_docs_example (tmp_path , example_folder , "poly.ert" )
241250
242- assert gui .available_fonts , "No fonts could be found by qt"
251+ if not gui .available_fonts :
252+ pytest .skip (SKIP_MESSAGE )
243253
244254 clean_up_diplayed_runpath (gui )
245255
@@ -263,7 +273,8 @@ def test_that_poly_new_with_results_screenshots_are_up_to_date(
263273
264274 gui = open_gui_with_docs_example (tmp_path , example_folder , "poly.ert" , 11223344 )
265275
266- assert gui .available_fonts , "No fonts could be found by qt"
276+ if not gui .available_fonts :
277+ pytest .skip (SKIP_MESSAGE )
267278
268279 run_experiment (qtbot , EnsembleExperiment , gui )
269280 open_storage (gui .ert_config .ens_path , mode = "w" )
@@ -301,7 +312,8 @@ def test_that_poly_new_with_observations_screenshots_are_up_to_date(
301312 tmp_path , example_folder , "poly_final.ert" , 11223344
302313 )
303314
304- assert gui .available_fonts , "No fonts could be found by qt"
315+ if not gui .available_fonts :
316+ pytest .skip (SKIP_MESSAGE )
305317
306318 run_experiment (qtbot , EnsembleSmoother , gui )
307319 open_storage (gui .ert_config .ens_path , mode = "w" )
@@ -358,7 +370,8 @@ def test_that_poly_new_with_more_observations_screenshots_are_up_to_date(
358370 tmp_path , example_folder , "poly_final.ert" , 11223344
359371 )
360372
361- assert gui .available_fonts , "No fonts could be found by qt"
373+ if not gui .available_fonts :
374+ pytest .skip (SKIP_MESSAGE )
362375
363376 run_experiment (qtbot , EnsembleSmoother , gui )
364377 open_storage (gui .ert_config .ens_path , mode = "w" )
0 commit comments