3737from easybuild .tools .output import PROGRESS_BAR_EXTENSIONS , PROGRESS_BAR_TYPES
3838from easybuild .tools .output import DummyRich , colorize , get_progress_bar , print_error , show_progress_bars
3939from easybuild .tools .output import start_progress_bar , status_bar , stop_progress_bar , update_progress_bar , use_rich
40- from easybuild .tools .utilities import only_if_module_is_available
4140
4241try :
4342 import rich .progress
@@ -142,11 +141,15 @@ def test_colorize(self):
142141
143142 self .assertErrorRegex (EasyBuildError , "Unknown color: nosuchcolor" , colorize , 'test' , 'nosuchcolor' )
144143
145- @only_if_module_is_available ('rich' )
146144 def test_colorize_rich (self ):
147145 """
148146 Test colorize function
149147 """
148+ try :
149+ import rich
150+ print (rich )
151+ except ImportError :
152+ self .skipTest ("rich not available" )
150153 update_build_option ('output_style' , 'rich' )
151154 for color in ('blue' , 'cyan' , 'green' , 'purple' , 'red' , 'yellow' ):
152155 self .assertEqual (colorize ('test' , color ), '[bold %s]test[/bold %s]' % (color , color ))
@@ -170,11 +173,14 @@ def test_print_error(self):
170173 expected = '\n \n This is yellow: \x1b [1;33ma banana\x1b [0m\n \n '
171174 self .assertEqual (stderr , expected )
172175
173- @only_if_module_is_available ('rich' )
174176 def test_print_error_rich (self ):
175177 """
176178 Test print_error function
177179 """
180+ try :
181+ import rich
182+ except ImportError :
183+ self .skipTest ("rich not available" )
178184 update_build_option ('output_style' , 'rich' )
179185 msg = "This is yellow: " + colorize ("a banana" , color = 'yellow' )
180186 self .mock_stderr (True )
0 commit comments