1818from ... import utility as niu
1919
2020# Try to enable the resource monitor
21- config .enable_resource_monitor ()
2221run_profile = config .resource_monitor
2322
2423
24+ @pytest .fixture (scope = "module" )
25+ def use_resource_monitor ():
26+ config .enable_resource_monitor ()
27+ yield
28+ config .disable_resource_monitor ()
29+
30+
2531class UseResourcesInputSpec (CommandLineInputSpec ):
2632 mem_gb = traits .Float (
2733 desc = 'Number of GB of RAM to use' , argstr = '-g %f' , mandatory = True )
@@ -51,7 +57,7 @@ class UseResources(CommandLine):
5157 os .getenv ('CI_SKIP_TEST' , False ), reason = 'disabled in CI tests' )
5258@pytest .mark .parametrize ("mem_gb,n_procs" , [(0.5 , 3 ), (2.2 , 8 ), (0.8 , 4 ),
5359 (1.5 , 1 )])
54- def test_cmdline_profiling (tmpdir , mem_gb , n_procs ):
60+ def test_cmdline_profiling (tmpdir , mem_gb , n_procs , use_resource_monitor ):
5561 """
5662 Test runtime profiler correctly records workflow RAM/CPUs consumption
5763 of a CommandLine-derived interface
@@ -73,7 +79,7 @@ def test_cmdline_profiling(tmpdir, mem_gb, n_procs):
7379 True , reason = 'test disabled temporarily, until funcion profiling works' )
7480@pytest .mark .parametrize ("mem_gb,n_procs" , [(0.5 , 3 ), (2.2 , 8 ), (0.8 , 4 ),
7581 (1.5 , 1 )])
76- def test_function_profiling (tmpdir , mem_gb , n_procs ):
82+ def test_function_profiling (tmpdir , mem_gb , n_procs , use_resource_monitor ):
7783 """
7884 Test runtime profiler correctly records workflow RAM/CPUs consumption
7985 of a Function interface
0 commit comments