18
18
from ... import utility as niu
19
19
20
20
# Try to enable the resource monitor
21
- config .enable_resource_monitor ()
22
21
run_profile = config .resource_monitor
23
22
24
23
24
+ @pytest .fixture (scope = "module" )
25
+ def use_resource_monitor ():
26
+ config .enable_resource_monitor ()
27
+ yield
28
+ config .disable_resource_monitor ()
29
+
30
+
25
31
class UseResourcesInputSpec (CommandLineInputSpec ):
26
32
mem_gb = traits .Float (
27
33
desc = 'Number of GB of RAM to use' , argstr = '-g %f' , mandatory = True )
@@ -51,7 +57,7 @@ class UseResources(CommandLine):
51
57
os .getenv ('CI_SKIP_TEST' , False ), reason = 'disabled in CI tests' )
52
58
@pytest .mark .parametrize ("mem_gb,n_procs" , [(0.5 , 3 ), (2.2 , 8 ), (0.8 , 4 ),
53
59
(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 ):
55
61
"""
56
62
Test runtime profiler correctly records workflow RAM/CPUs consumption
57
63
of a CommandLine-derived interface
@@ -73,7 +79,7 @@ def test_cmdline_profiling(tmpdir, mem_gb, n_procs):
73
79
True , reason = 'test disabled temporarily, until funcion profiling works' )
74
80
@pytest .mark .parametrize ("mem_gb,n_procs" , [(0.5 , 3 ), (2.2 , 8 ), (0.8 , 4 ),
75
81
(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 ):
77
83
"""
78
84
Test runtime profiler correctly records workflow RAM/CPUs consumption
79
85
of a Function interface
0 commit comments