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